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

Re: Bad bug in partitioning in squeeze installer



On Mon, Nov 15, 2010 at 06:02:42PM +1300, Andrew Hill wrote:
> Using the text GUI partitioning tool it appears to make the cylinders
> inclusive, not exclusive.
> 
> 
> fdisk /dev/sda -l
> 
> Disk /dev/sda: 500.1 GB, 500107862016 bytes
> 255 heads, 63 sectors/track, 60801 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0xe0c5913d
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1        2550    20482843+  83  Linux
> /dev/sda2            2551       17750   122093748    7  HPFS/NTFS
> /dev/sda3           17750       55804   305664000   83  Linux
> /dev/sda4           55804       60802    40144897    5  Extended
> /dev/sda5           55804       56290     3905536   82  Linux swap / Solaris
> /dev/sda6           56290       60802    36238336   83  Linux
> 
> As you can see sda3/sda5/sda6 all have overlapping cylinders.

One important thing to bear in mind here is that we no longer align to
cylinder boundaries, because doing so results in poor performance on
modern disks and the disks on which it was important to align to
cylinder boundaries are decades old by now.  As such, it's perfectly
possible for a correct partition table to have a partition end in the
middle of one cylinder and the next partition start in the middle of the
same cylinder.  In fact, I would expect most modern partition tables to
be this way.  Overlapping cylinders are fine - it's overlapping sectors
that would be a real problem.

For example, here's the valid partition table on my laptop (which has an
SSD disk which would exhibit poor performance if aligned on cylinder
boundaries, and so all partitions except for the Dell partition at the
start which I should probably delete are aligned on megabyte
boundaries):

  /dev/sda1               1          14      112423+  de  Dell Utility
  /dev/sda2              15        9730    78038016    f  W95 Ext'd (LBA)
  /dev/sda5              15        9240    74104832   83  Linux
  /dev/sda6            9240        9730     3931136   82  Linux swap / Solaris

It looks as though /dev/sda5 and /dev/sda6 overlap, right?  But that's
not so.  'sfdisk -d /dev/sda' shows a more detailed picture, in sectors:

  /dev/sda1 : start=       63, size=   224847, Id=de
  /dev/sda2 : start=   225280, size=156076032, Id= f
  /dev/sda3 : start=        0, size=        0, Id= 0
  /dev/sda4 : start=        0, size=        0, Id= 0
  /dev/sda5 : start=   227328, size=148209664, Id=83
  /dev/sda6 : start=148439040, size=  7862272, Id=82

The size is inclusive of the first sector, so we take 227328 + 148209664
- 1 which is 148436991.  This leaves 2048 sectors = 1 megabyte between
the two partitions, which is the chained extended partition table plus
alignment.  No overlap, despite the confusing and incomplete picture
presented by fdisk.

> This is error from cfdisk
> FATAL ERROR: Bad primary partition 3: Partition ends in the final partial
> cylinder

There have certainly been relatively recent versions of cfdisk that
exhibited this problem for me; for example, the version in Ubuntu 10.10
does this.  However, I can no longer reproduce this with the version in
Debian testing/unstable (which is incidentally also in the development
branch that will become Ubuntu 11.04).  It looks to me as though it
should have been fixed in util-linux 2.17.2-1.

We would need to see your exact partition table, as reported by 'sfdisk
-d /dev/sda', to figure out more.  It would also be helpful to provide
/var/log/partman, which shows the partitioning actions taken by the
installer.

Data corruption is of course a serious problem, but it is not yet clear
whether it is related to your partition table layout.  It could well be
entirely unrelated.

Regards,

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: