[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _primary_constraint(): start_geom is uninitialized if min_geom==0 &&

From: Jean-Christian de Rivaz
Subject: Re: _primary_constraint(): start_geom is uninitialized if min_geom==0 && cylinder_size < dev->length. Debian bug #602568
Date: Tue, 09 Nov 2010 20:36:53 +0100
User-agent: Mozilla-Thunderbird (X11/20100329)

Jim Meyering a écrit :
Jean-Christian de Rivaz wrote:
Jim Meyering a écrit :
Jean-Christian de Rivaz wrote:
address@hidden:/home/jcdr/parted-git/parted/build-O0# parted/parted
/dev/sdb print
Model: disk2go PURE II (scsi)
Disk /dev/sdb: 5243kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End     Size    Type     File system  Flags
 1      5120B  5243kB  5238kB  primary

Now I just wonder if parted should display FAT16 in the file system
field. Because fdisk do it:

address@hidden:/home/jcdr/parted-git/parted/build-O0# fdisk -l /dev/sdb

Disk /dev/sdb: 5 MB, 5242880 bytes
1 heads, 10 sectors/track, 1024 cylinders
Units = cylinders of 10 * 512 = 5120 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               2        1024        5115    6  FAT16
It seems that 4MiB is the minimum size of a FAT16 file system,
and at 2.5MiB, yours is well under the minimum, so with the latter
interpretation, parted is correct not to report it as one.
Sorry, I failed to find where this /deb/sdb1 partition is 2.5MiB in
size. Seem to be 5.1MiB (5238kB, or (1024-2+1)*512*10/2.0**20=4.99MiB
according to fdisk) to me ( > 4MiB ). This is also confirmed by the
system while mounting the /deb/sdb1 partition:

Oh.  I looked at sdb1's partition size, rather than the device size.
Thanks for the correction.  In that case, it sounds like a bug.
Can you debug it?

I have traced the problem to the fat_boot_sector_probe_type() function from the file libparted/fs/fat/bootsector.c. In particular the last couple of lines:

        if (cluster_count > MAX_FAT12_CLUSTERS)
                return FAT_TYPE_FAT16;
                return FAT_TYPE_FAT12;

And in fat.h, MAX_FAT12_CLUSTERS has value 4086. The small FAT16 partition on my /dev/sdb1 have cluster_count = 2544, so the function returns FAT_TYPE_FAT12. Since parted don't support FAT12, it do not display this file system type. I found curious that the "File system is FAT12, which is unsupported." from the fat_boot_sector_analyse() is not displayed. I tested to change MAX_FAT12_CLUSTERS to 2048 and parted report a fat16 file system for my /dev/sdb1.

A this point I fail to understand why parted probe the file system type this way as the primary information should be the partition identifier from the MBR: 0x01 for FAT12 and 0x04, 0x06, 0x0E for FAT16.

If we found a way to get the partition identifier from the fat_boot_sector_probe_type() function, the code could be something like this:

     if (partition_identifier == 0x01 &&
         cluster_count <= MAX_FAT12_CLUSTERS)
                return FAT_TYPE_FAT12;
                return FAT_TYPE_FAT16;

If this proposition is reasonable, my problem is how to get the partition_identifier.

Or should we use an other way to make the difference between FAT12 and FAT16 ?

Jean-Christian de Rivaz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]