bug-parted
[Top][All Lists]
Advanced

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

Unusual geometry makes parted unhappy


From: Robin Munn
Subject: Unusual geometry makes parted unhappy
Date: Thu, 29 Dec 2005 02:16:40 -0600

I have a 300G external hard disk that I partitioned using OS X 10.3's
Disk Utility Program, allocating all 300G in one FAT32 partition. The
resulting partition can be read just fine under Windows, OS X, and
Linux, and I've been using it happily for months. Recently, though, I
decided to shrink the FAT32 partition down and create an ext3
partition on there so I could back up my Linux machine (I've got some
symlinks in the directories I need to back up, and FAT32 doesn't take
kindly to symlinks). I then discovered that Disk Utility had written a
rather unusual disk geometry to the partition table, and parted was
complaining.

rmunn$ sudo parted /dev/sda
GNU Parted 1.6.25.1
[snip]
Using /dev/sda
(parted) print
Error: Can't have a partition outside the disk!
(parted) quit

rmunn$ sudo fdisk -l /dev/sda
Disk /dev/sda: 300.0 GB, 300069052416 bytes
82 heads, 1 sectors/track, 7147224 cylinders
Units = cylinders of 82 * 512 = 41984 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1     7147225   293036180+   b  W95 FAT32

rmunn$ sudo fdisk -l -u /dev/sda
Disk /dev/sda: 300.0 GB, 300069052416 bytes
82 heads, 1 sectors/track, 7147224 cylinders, total 586072368 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               8   586072368   293036180+   b  W95 FAT32


Going into "expert mode" in fdisk and doing a "(p)rint", I got the following:

Disk /dev/sda: 82 heads, 1 sectors, 7147224 cylinders

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 00   0   9    0  81   1 1023          8  586072361 0b
 2 00   0   0    0   0   0    0          0          0 00
 3 00   0   0    0   0   0    0          0          0 00
 4 00   0   0    0   0   0    0          0          0 00


Doing a "(d)ump" of the partition table gave me the following:

Device: /dev/sda
0x000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[snip: nothing but 0's]
0x1A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1B0: 00 00 00 00 00 00 00 00 87 74 6F F1 00 00 00 00
0x1C0: 09 00 0B 51 C1 FF 08 00 00 00 29 C1 EE 22 00 00
0x1D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA


cfdisk complains about the geometry and refuses to start:

"FATAL ERROR: Bad primary partition 0: Partition ends after end-of-disk
Press any key to exit cfdisk"


sfdisk complains that the kernel's idea of disk geometry (C/H/S
36481/255/63) doesn't match what's listed on the partition table:

rmunn$ sudo sfdisk -l /dev/sda
/dev/sda: 36481 cylinders, 255 heads, 63 sectors/track
Warning: The partition table looks like it was made
  for C/H/S=*/82/1 (instead of 36481/255/63).
For this listing I'll assume that geometry.
Units = cylinders of 41984 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0+ 7147224- 7147224- 293036180+   b  W95 FAT32
                start: (c,h,s) expected (0,8,1) found (0,0,9)
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty


All of this is on Ubuntu Breezy, running a 2.6.12 kernel, and running
parted 1.6.25.1. (Breezy comes with "GNU Parted 1.6.21 with HFS shrink
patch 16", but I downloaded and compiled the latest parted to make
sure the behavior still happened. It does.) And just to re-iterate:
I've been able to write to, and read from, this partition under Win XP
Pro, OS X 10.3, and Ubuntu Breezy.

The only place in parted where the error message "Can't have a
partition outside the disk!" can be found is in libparted/geom.c
(libparted/cs/geom.c in latest SVN trunk), in the ped_geometry_set
function, inside the test "if (start < 0 || start + length - 1 >=
geom->dev->length) { ... }".

Since I couldn't get parted to resize the partition for me, I've
copied all the data from it off onto another drive in preparation for
destructive repartitioning. I haven't deleted the partition yet,
though. If you want more information, I can provide it. I can also do
all sorts of destructive partitioning experiments if you'd like, now
that the drive has no data I care about anymore.

--
Robin Munn
address@hidden
GPG key 0xD6497014

reply via email to

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