On Mon, Dec 29, 2008 at 04:44:06PM +0100, Giuseppe Sacco wrote: > Package: util-linux > Version: 2.13.1.1-1 > Severity: grave > Tags: patch > > Yesterday I tried the d-i rc1 for lenny on a silicon graphics O2 (a > complete report is available as Debian bug #510060). > > The problem I found against fdisk is that when using large disks (i.e., > disks with more than 4096 sectors per cylinder), the volhdr partition is > incorrectly sized because it is marked as starting and ending on > cylinder 0. When having this specific case, this is what happen: > > Command (m for help): p > > Disk /dev/sda (SGI disk label): 255 heads, 63 sectors, 8941 cylinders > Units = cylinders of 16065 * 512 bytes > > ----- partitions ----- > Pt# Device Info Start End Sectors Id System > ----- Bootinfo ----- > Bootfile: /unix > ----- Directory Entries ----- > 0: arcboot sector 4 size 72492 > > Command (m for help): n > Partition number (1-16): 1 > Attempting to generate entire disk entry automatically. > First cylinder (1-8940, default 1): > Using default value 1 > Last cylinder (1-8940, default 8940): 2000 > > Command (m for help): p > > Disk /dev/sda (SGI disk label): 255 heads, 63 sectors, 8941 cylinders > Units = cylinders of 16065 * 512 bytes > > ----- partitions ----- > Pt# Device Info Start End Sectors Id System > 1: /dev/sda1 boot 1 2000 32130000 83 Linux native > 9: /dev/sda2 0 0 4096 0 SGI volhdr > 11: /dev/sda3 0 8940 143637165 6 SGI volume > ----- Bootinfo ----- > Bootfile: /unix > ----- Directory Entries ----- > 0: arcboot sector 4 size 72492 > > > Command (m for help): n > Partition number (1-16): 2 > First cylinder (1-0): 1 > Value out of range. > First cylinder (1-0): 0 > Value out of range. > First cylinder (1-0): 2001 > Value out of range. > First cylinder (1-0): ^C > > As you may see, once the first partition has been created, fdisk will > automatically create partitions 9 and 11, but it will wrongly set the > end boundary of volhdr. Starting with this error, it is not possible to > add any new partition, because the accepted cylinder range would be > "1-0". > > Please find attached a solution for this bug. This solution raise the > volhdr size of 4096 up to the first cylinder boundary. If the boundary > is less than 4096 then nothing is changed. >
While I agree with the analysis, the patch looks more like a workaround than a real solution. The problem is that when free space doesn't start on a cylinder boundary (the case for the free space after the volume header), there might be less than one cylinder to create a partition. The code to ask for partition boundaries is using cylinders (probably because partition start should be cylinder aligned) and thus doesn't cope with this issue. The patch below fixes the issue by making sure free space always starts as a cylinder boundary, as anyway that's the only possible location to create a new partition. --- util-linux-2.13.1.1.orig/fdisk/fdisksgilabel.c +++ util-linux-2.13.1.1/fdisk/fdisksgilabel.c @@ -501,6 +501,9 @@ } start = sgi_get_start_sector(Index[i]) + sgi_get_num_sectors(Index[i]); + /* Align free space on cylinder boundary */ + if (start % cylsize != 0) + start += cylsize - (start % cylsize); if (debug > 1) { if (verbose) printf("%2d:%12d\t%12d\t%12d\n", Index[i], -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org