War story: another oddball partition table causes problem years after creation
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Mon Nov 4 02:11:38 UTC 2013
| From: D. Hugh Redelmeier <hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org>
| Subject: Re: [TLUG]: Ubuntu 12.04 won't install due to odd partitioning
| Date: Wed, 16 May 2012 01:18:59 -0400 (EDT)
| and run parted from the console, it prints a terse message to stderr:
| ======================
| libparted : 2.3
| ======================
| Can't have a partition outside the disk!
I got another of these odd partitions tables. This time it's in an
external hard drive dating back to 2010 August. I wonder what software
was broken then -- I don't have a record of what I used for partitioning
then.
I now want to change the partitions and gparted won't touch it.
The symptoms are:
1) gparted seemed to show the unassigned space as being enormous
(perhaps hundreds of thousands of terabytes).
2) it will not deal with the disk, reporting
Can't have overlapping partitions
Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes, 2930277168 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 label type: dos
Disk identifier: 0x3c1257ff
Device Boot Start End Blocks Id System
/dev/sdb1 * 14336 2930272064 1465128864+ 5 Extended
/dev/sdb5 16384 488390655 244187136 7 HPFS/NTFS/exFAT
/dev/sdb6 488392704 976766975 244187136 7 HPFS/NTFS/exFAT
/dev/sdb7 976769024 1465143295 244187136 7 HPFS/NTFS/exFAT
/dev/sdb8 1465145344 1953519615 244187136 7 HPFS/NTFS/exFAT
/dev/sdb9 1953521664 2441895935 244187136 7 HPFS/NTFS/exFAT
/dev/sdb10 2441897984 2930272255 244187136 7 HPFS/NTFS/exFAT
Notice that logical partition 10's end is slightly larger than the end of
the extended partition 1 (which is supposed to contain it).
Each partition starts on a 1MiB boundary (good)
Each partition is a multiple of 1MiB in length EXCEPT the extended
partition.
There is still room at the end of the drive so I think all I have to
do is zap the partition table to change the end of partition 1 to
match the end of partition 10.
<http://gparted.org/h2-fix-msdos-pt.php>
OK, here's what I did:
- unmounted all the partitions (something automounts them)
[root at g70 hugh]# sudo sfdisk -d /dev/sdb > sdb-backup.txt
sfdisk: Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
[root at g70 hugh]# cat sdb-backup.txt
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 14336, size=2930257729, Id= 5, bootable
/dev/sdb2 : start= 0, size= 0, Id= 0
/dev/sdb3 : start= 0, size= 0, Id= 0
/dev/sdb4 : start= 0, size= 0, Id= 0
/dev/sdb5 : start= 16384, size=488374272, Id= 7
/dev/sdb6 : start=488392704, size=488374272, Id= 7
/dev/sdb7 : start=976769024, size=488374272, Id= 7
/dev/sdb8 : start=1465145344, size=488374272, Id= 7
/dev/sdb9 : start=1953521664, size=488374272, Id= 7
/dev/sdb10: start=2441897984, size=488374272, Id= 7
[root at g70 hugh]# diff sdb-backup.txt sdb-fixed.txt
4c4
< /dev/sdb1 : start= 14336, size=2930257729, Id= 5, bootable
---
> /dev/sdb1 : start= 14336, size=2930257920, Id= 5, bootable
[root at g70 hugh]# sudo sfdisk /dev/sdb < sdb-fixed.txt
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 182401 cylinders, 255 heads, 63 sectors/track
sfdisk: 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+ 182400 182401- 1465128864+ 5 Extended
/dev/sdb2 0 - 0 0 0 Empty
/dev/sdb3 0 - 0 0 0 Empty
/dev/sdb4 0 - 0 0 0 Empty
/dev/sdb5 1+ 30400- 30400- 244187136 7 HPFS/NTFS/exFAT
/dev/sdb6 30401+ 60800- 30400- 244187136 7 HPFS/NTFS/exFAT
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,10,10)
/dev/sdb7 60801+ 91200- 30400- 244187136 7 HPFS/NTFS/exFAT
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,15,15)
/dev/sdb8 91201+ 121600- 30400- 244187136 7 HPFS/NTFS/exFAT
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,20,20)
/dev/sdb9 121601+ 152000- 30400- 244187136 7 HPFS/NTFS/exFAT
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,25,25)
/dev/sdb10 152001+ 182401- 30400- 244187136 7 HPFS/NTFS/exFAT
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,30,30)
New situation:
Units: sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb1 * 14336 2930272255 2930257920 5 Extended
/dev/sdb2 0 - 0 0 Empty
/dev/sdb3 0 - 0 0 Empty
/dev/sdb4 0 - 0 0 Empty
/dev/sdb5 16384 488390655 488374272 7 HPFS/NTFS/exFAT
/dev/sdb6 488392704 976766975 488374272 7 HPFS/NTFS/exFAT
/dev/sdb7 976769024 1465143295 488374272 7 HPFS/NTFS/exFAT
/dev/sdb8 1465145344 1953519615 488374272 7 HPFS/NTFS/exFAT
/dev/sdb9 1953521664 2441895935 488374272 7 HPFS/NTFS/exFAT
/dev/sdb10 2441897984 2930272255 488374272 7 HPFS/NTFS/exFAT
Warning: partition 1 does not end at a cylinder boundary
Warning: partition 5 does not end at a cylinder boundary
Warning: partition [6] does not start at a cylinder boundary
Warning: partition [6] does not end at a cylinder boundary
Warning: partition 6 does not end at a cylinder boundary
Warning: partition [7] does not start at a cylinder boundary
Warning: partition [7] does not end at a cylinder boundary
Warning: partition 7 does not end at a cylinder boundary
Warning: partition [8] does not start at a cylinder boundary
Warning: partition [8] does not end at a cylinder boundary
Warning: partition 8 does not end at a cylinder boundary
Warning: partition [9] does not start at a cylinder boundary
Warning: partition [9] does not end at a cylinder boundary
Warning: partition 9 does not end at a cylinder boundary
Warning: partition [10] does not start at a cylinder boundary
Warning: partition [10] does not end at a cylinder boundary
Warning: partition 10 does not end at a cylinder boundary
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).)
[root at g70 hugh]# parted /dev/sdb unit s print
Model: WDC WD15 WD-WMAVU145 (scsi)
Disk /dev/sdb: 2930277168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 14336s 2930272255s 2930257920s extended boot
5 16384s 488390655s 488374272s logical ntfs
6 488392704s 976766975s 488374272s logical ntfs
7 976769024s 1465143295s 488374272s logical ntfs
8 1465145344s 1953519615s 488374272s logical ntfs
9 1953521664s 2441895935s 488374272s logical ntfs
10 2441897984s 2930272255s 488374272s logical ntfs
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list