Ubuntu Installer borks up partitions?

Tom H tomh0665 at gmail.com
Thu Jul 4 23:08:15 UTC 2013


On Thu, Jul 4, 2013 at 11:37 AM, Sander Smeenk <ssmeenk at freshdot.net> wrote:
> Quoting Tom H (tomh0665 at gmail.com):
>>>
>>> And there i'm stuck.
>>
>> You're starting your logical partition outside the extended partition:
>> Adding logical partition 5
>> First sector (503806-207257599, default 503806): 501760
>
> Yeah. I know.
>
> Did you read my entire email or just the part where i tried specifying a
> sector outside the extended partition?
> The example was just to illustrate that it is impossible to (re)create a
> partition layout that has been created by the Ubuntu installer.
>
>>> Other fdisk tools like sfdisk complain about the Ubuntu Installer
>>> provided partition layout having an 'extended partition [that] does
>>> not start at a cylinder boundary'. Its output is:
>>> | sfdisk: Warning: extended partition does not start at a cylinder boundary.
>>
>> Did you use "sfdisk -uC -l"?! Make sure that you use "sfdisk -uS -l"
>> (or "sfdisk -uB -l", "sfdisk -uM -l").
>
> Still 'sfdisk' complains about "Warning: extended partition does not
> start at a cylinder boundary."
>
> The problem is there's something wrong with the partition layout created
> by the Ubuntu installer.




Forget about the cylinders.

I'd run the commands below but forgot to copy them out and email them.
So I had to redo the whole thing again...

The installer's layout can be re-created with sfdisk so I doubt that
recreating the installer's layout with fdisk is a bug.




FORMAT SDB INTO SDB1-SDB2-SDB5 USING DEFAULTS
/dev/sdb2 starts at 499712 rather than at 501758 with the installer

[root at saucybox:~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or
OSF disklabel
Building a new DOS disklabel with disk identifier 0xf7b49ed1.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-2097151, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): 499711

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (1-4, default 2):
Using default value 2
First sector (499712-2097151, default 499712):
Using default value 499712
Last sector, +sectors or +size{K,M,G} (499712-2097151, default 2097151):
Using default value 2097151

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (501760-2097151, default 501760):
Using default value 501760
Last sector, +sectors or +size{K,M,G} (501760-2097151, default 2097151):
Using default value 2097151

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf7b49ed1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      499711      248832   83  Linux
/dev/sdb2          499712     2097151      798720    5  Extended
/dev/sdb5          501760     2097151      797696   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.




PRINT THE TABLE WITH FDISK AND SFDISK

[root at saucybox:~]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf7b49ed1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      499711      248832   83  Linux
/dev/sdb2          499712     2097151      798720    5  Extended
/dev/sdb5          501760     2097151      797696   83  Linux
[root at saucybox:~]#
[root at saucybox:~]#
[root at saucybox:~]# sfdisk -l -uS /dev/sdb

Disk /dev/sdb: 130 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1          2048    499711     497664  83  Linux
/dev/sdb2        499712   2097151    1597440   5  Extended
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
/dev/sdb5        501760   2097151    1595392  83  Linux




DUMP THE TABLE TO A FILE

[root at saucybox:~]# sfdisk -d /dev/sdb > u-u
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
[root at saucybox:~]#
[root at saucybox:~]#
[root at saucybox:~]# cat u-u
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=   497664, Id=83
/dev/sdb2 : start=   499712, size=  1597440, Id= 5
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0
/dev/sdb5 : start=   501760, size=  1595392, Id=83




EDIT THE DUMPED TABLE TO MAKE SDB2 START AT 501758

[root at saucybox:~]# vi u-u
[root at saucybox:~]#
[root at saucybox:~]#
[root at saucybox:~]# cat u-u
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=   497664, Id=83
/dev/sdb2 : start=   501758, size=  1597440, Id= 5
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0
/dev/sdb5 : start=   501760, size=  1595392, Id=83




FORMAT THE DISK WITH THE NEW TABLE

[root at saucybox:~]# sfdisk -f /dev/sdb < u-u
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 130 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+     31-     31-    248832   83  Linux
/dev/sdb2         31+    130-    100-    798720    5  Extended
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
/dev/sdb5         31+    130-    100-    797696   83  Linux
Warning: given size (1597440) exceeds max allowable size (1595394)
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1          2048    499711     497664  83  Linux
/dev/sdb2        501758   2099197    1597440   5  Extended
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
/dev/sdb5        501760   2097151    1595392  83  Linux
Warning: partition 2 extends past end of disk
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)




PRINT THE TABLE WITH FDISK AND SFDISK

[root at saucybox:~]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf7b49ed1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      499711      248832   83  Linux
/dev/sdb2          501758     2099197      798720    5  Extended
/dev/sdb5          501760     2097151      797696   83  Linux
[root at saucybox:~]#
[root at saucybox:~]#
[root at saucybox:~]# sfdisk -l -uS /dev/sdb

Disk /dev/sdb: 130 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1          2048    499711     497664  83  Linux
/dev/sdb2        501758   2099197    1597440   5  Extended
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
/dev/sdb5        501760   2097151    1595392  83  Linux
[root at saucybox:~]#




More information about the ubuntu-users mailing list