Comment 8 for bug 428318

Revision history for this message
Lawrence Rust (lawrence-softsystem) wrote : Re: unable to mount an ext2 partition by label or uuid

Apologies for the delay in replying but I've been away for the last week.

I fully take on board your comments and have reviewed the code in util-linux-ng-2.15, noting that libblkid now uses a completely rewritten method of probing for file systems.

It's clear that this problem stems from the new detection routines in libs/blkid/src/probers/vfat.c. At the end of this file the struct blkid_idinfo is declared with some magic search strings. In particular, 2 patterns are defined to match the single byte jmp/bra opcodes at the start of a DOS boot sector. My /dev/sdb1 partition was once formatted for DOS and so matches these patterns and consequently the function probe_vfat is called. For these simple patterns the function probe_fat_nomagic is called to filter out false positives. In normal circumstances only MSDOS 2 and earlier floppies should be detected by this function. A very important feature of these disks is the boot signature - bytes 0x55, 0xaa at the end of the 1st sector which indicate to the BIOS that the disk is bootable. All MSDOS floppies have these bytes but the function probe_fat_nomagic doesn't test for them.

When I used gparted to reformat this DOS partition to ext2 it overwrote the MSDOS system name (offset 3), the FAT16 magic signature (offset 0x36) and the boot signature at offset 0x1fe but left the BPB intact, which causes the confusion. To fix this I wrote a small patch which I have attached.

I sincerely hope that you can add this to the 9.10 release in case it affects many other users with older systems.