When trying to partition a hard drive on ESX server I frequently run into the following problem:
$ fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdd: 2684 MB, 2684157952 bytes
83 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 5146 * 512 = 2634752 bytes
Device Boot Start End Blocks Id System
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
Rebooting the machine always resolves the problem. However, rebooting is not an acceptable solution.
Any insight into the problem would be appreciated.