Partition tables sometimes misdetected as single large FAT file system
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Parted |
Invalid
|
Undecided
|
Unassigned | ||
parted (Ubuntu) |
Fix Released
|
High
|
Colin Watson | ||
Hardy |
Fix Released
|
High
|
Colin Watson |
Bug Description
When a FAT file system is written to a whole disk device, it appears rather like a DOS partition table in some ways. libparted therefore needs to detect this situation and explicitly bail out of treating it as a DOS partition table. However, its detection is a bit broken at the moment and has some false positives. Specifically, if the disk previously had a FAT file system covering its entire extent, but then had a partition table written to it, it can happen that the FAT signature is left around and confuses libparted.
Both the Linux kernel and fdisk use a more reliable method, namely checking the boot indicator byte of all four partitions in the primary partition table to ensure that each one is either 0 or 0x80. libparted should be in sync with these. I sent a patch upstream (http://
Attached is the diff between 1.7.1-5.1ubuntu9 in hardy and the proposed 1.7.1-5.1ubuntu9.1.
TEST CASE: This is a bit tricky to set up. The most obvious way is probably to replicate the reporter's partition table on a loopback device. To do this, download http://
dd if=/dev/zero of=parted-test bs=1024 count=$
dd if=232175 of=parted-test bs=512 count=1 conv=notrunc
parted -s parted-test print
With the old libparted1.7-1, this erroneously prints:
Disk /home/cjwatson/
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00kB 1153MB 1153MB fat32
The new one correctly prints:
Disk /home/cjwatson/
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 16.4kB 751MB 751MB primary boot
2 751MB 1027MB 276MB primary
Please also check that parted still understands your own partition table correctly: 'sudo parted -s /dev/sda print', replacing /dev/sda with each of whichever disk devices you have.
Regression potential: We'll have to watch out for new partitioner bugs of the form "partitions on this disk not recognised at all". However, given that we're now in sync with the Linux kernel, I suspect that it's more likely that any regressions would be FAT file systems erroneously detected as partition tables (i.e. the other way round). It might be worth trying this out with USB sticks.
Changed in parted: | |
status: | Incomplete → Confirmed |
Changed in parted: | |
status: | Confirmed → Triaged |
Changed in parted: | |
status: | Unknown → New |
Changed in parted: | |
milestone: | none → ubuntu-8.04.1 |
Could I get a dump of the partition table, please? The output of 'sudo od -tx1 -Ax -N512 /dev/sdc' should be sufficient.