bug-parted
[Top][All Lists]
Advanced

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

Re: Verbatim USB drive crashes libparted


From: Curtis Gedak
Subject: Re: Verbatim USB drive crashes libparted
Date: Fri, 11 Feb 2011 13:21:28 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

T Kortehisto,

Using the equations noted in the probe_partition_for_geom() method in the parted file libparted/labels/dos.c, I ran the calculations using the values from the MBR you provided.


  *Variable* *Description / Calculation* *Value*
           c     Starting cylinder                     1
           h     Starting head                         0
           s     Starting sector – 1 =                 0
           a     Starting LBA                      8,064
           C     Ending cylinder                     969
           H     Ending head                          85
           S     Ending Sector – 1 =                  21
           A     Ending LBA                    7,827,455
        a_ =     a – s =                           8,064
        A_ =     A – S =                       7,827,434
     denum =     c * H – C * h =                      85
                 a_ * H =                        685,440
                 A_ * h =                              0
  cyl_size =     (a_ * H – A_ * h) / denum =       8,064
                          cyl_size * denum =     685,440
                          a_ * H – A_ * h        685,440
head_size1 =     (a_ – (c * cyl_size)) / h =         n/a
head_size2 =     (A_ – (C * cyl_size)) / H =         157
    heads1 =     cyl_size / head_size1 =             n/a
    heads2 =     cyl_size / head_size2 =              51


Assuming my calculations are correct, a head_size of 157 sectors was determined. This is the number of sectors that would pass under a single disk head in a single rotation of the disk. Unfortunately this value is too large for the MBR specification (range is 1 to 63 sectors), and hence the partition table on your disk device is indeed invalid.


I agree with Brian C. Lane that it would better if parted/libparted were to cleanly indicate that the partition table was invalid as opposed to throwing a stack trace.


Regards,
Curtis Gedak
(Maintainer of GParted)


REFERENCES:
Libparted function probe_partition_for_geom() in file dos.c:
http://git.debian.org/?p=parted/parted.git;a=blob;f=libparted/labels/dos.c;h=578180bc6658d5f4e0812d5976a1499bc95c8d9b;hb=HEAD#l595

MBR Specification:
http://en.wikipedia.org/wiki/Master_boot_record





reply via email to

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