fdisk doesn't write MBR if only Windows NT ID is changed.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
util-linux (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: util-linux
Ubuntu 7.10, util-linux 2.13-8ubuntu1.
If the only change to a disc's MBR in fdisk is to use the `expert' menu's `i' option to set the MBR's Window NT's ID, now used by Linux for EDD, then the altered partition isn't written back to disc so the change isn't done. This seems to be because write_table() doesn't call write_sector() which calls write(2) unless one of the four primary partition entries has been altered, which is the case of `i', they haven't.
fdisk misleadingly goes onto say
Expert 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 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
but this isn't true and on the next reboot the old ID will still be present. This can also be seen with a hexdump before reboot, "hexdump -C -s 440 -n 4 /dev/sda".
A workaround is to toggle a partition's boot flag with the `a' command, thus setting the `partition foo is changed' flag, toggle it again, which doesn't clear said changed flag, then use the expert `i' command to change the ID before using `w' to write the MBR.