Parted corrupts the partition table

Bug #8322 reported by Sebastian Breier on 2004-09-21
Affects Status Importance Assigned to Milestone
parted (Ubuntu)
Colin Watson

Bug Description

I'll mostly describe what I've done, so people with better knowledge of
partitions and disk management might find it useful.

Before I installed last week, I deleted my Debian partitions on the disk I
wanted to install Ubuntu to.


The disk looks like this:
NTFS (50G)
Empty (7G)
NTFS (57G)

It's not my Win2k-partition, it only has some data on it, in two partitions. The
"Empty" space is where I usually keep my Linux installations. I emptied it using
Partition Magic, and the disk looked alright before installing.

Then I installed Ubuntu and used it for a few days:
NTFS (50G)
Ubuntu Root (7G)
Swap (350MB)
NTFS (57G)

Yesterday I thought about increasing the size of the Ubuntu partition, so I
started PMagic.


It told me that the partition table of the disk had some errors (something about
CHS and LBA values being different although they should match) and if it should
fix it. This is nothing special, I get this often when repartitioning the disk,
so I said Yes a few times, till the program opened.

But the disk had a "BAD" label and had no partitions + a small label "Error 108".

Error 108 is a partition table error. When I checked it with some other
programs, Linux fdisk said the partition table didn't match the drive geometry
(some cylinder settings or somewhat are wrong).

I found no way to fix this. The disk worked flawlessly in Linux and Win2k, but I
wanted an error-free partition table, so I backed up all the data and formatted.

This time, I created all partitions before the installation in Partition Magic,
then retrieved my backups of NTFS, then re-installed Ubuntu (the Ubuntu backup
had errors, so I had to reinstall).

In the installer, I selected the ext3 and swap partitions to be used.

After the installation, same problem again: The partition table had errors.


Some people on IRC Freenode #ubuntu helped me find some answers, and so I wanted
to try out other BIOS settings for the drive. (Infos from this article: )

My BIOS only has a switch "LBA: On/Off" for each drive, and it was on for the
Linux/NTFS disk. I switched it to off.

Booted Win2k, opened PMagic: First again some fixable errors about CHS/LBA
values, but in the main program the disk was "BAD" again.

Changed the BIOS setting to on again: Some fixable errors, but now the disk was
good again?! The partition table had no errors, PMagic could see the whole drive
with all partitions.


I have no idea how this has worked out... my guess is that the switching between
LBA/non-LBA mode and PMagic repairing my partition table somehow resulted in a
partition table with all values matching, and no errors.

Well, the problem with the last Ubuntu install was, that I still wanted my
backup, so I had it installed and then extracted my backup over it. Didn't work
out, couldn't boot anymore, so I had to reinstall again.

Well, interestingly, after this reinstall (with selecting the partitions and
formatting them in the installer), it was still the same: No partition errors.

So now I got a working Ubuntu installation and a fully working partition table.

One of the Ubuntu devs said on IRC that it looked pretty much like a parted
problem, and he cited some changes in the parted sources that matched pretty
much the problems I had.

Maybe also of note is this: When I had installed Debian (February/March 2004)
testing/Sarge, I had none of these problems. It just worked. So the bug might
have been introduced between then and now.

My fix (switching LBA setting) might look more like an act of the goddess than a
reproducible repair, but it might give some hints for the bug in parted.

Disclaimer: I was advised by a dev to file this bug. It's not like I have no
other place to save the experiences of my last day to. ;)

Matt Zimmerman (mdz) wrote :

This sounds like the parted geometry problem which has been discussed on
ubuntu-users, and which is supposedly fixed upstream in parted. Colin, do you

Colin Watson (cjwatson) wrote :

Created an attachment (id=229)
backported fix for parted C/H/S problems

Colin Watson (cjwatson) wrote : is also useful reading.

This issue was fixed upstream in parted 1.6.12; however, that introduces ABI
incompatibility, so it's best not to introduce it at this time. Debian's parted
package includes a backported patch for this bug, and the patch applies cleanly
to the version in warty. The attached patch should therefore be a fix.

Jeff/Matt, what do you think about uploading this at this point? I think we have
to fix this bug one way or the other before the final warty release, so it's
only a question of the invasiveness of the fix, and backporting this single
patch seems least invasive.

I've put a CD containing this patch at, and would
like feedback from people affected by the bug.

Matt Zimmerman (mdz) wrote :

Please send a call for testers to ubuntu-users; if we can get enough positive
feedback about the fix, it can go into Warty

Matt Zimmerman (mdz) wrote :

*** Bug 8288 has been marked as a duplicate of this bug. ***

Matt Zimmerman (mdz) wrote :

We have a proposed fix for this problem, but so far none of us are able to
reproduce it, and so are unable to test.

Sebastian? Will you help us to test the fix?

Sebastian Breier (tomcat42) wrote :

(In reply to comment #6)
> We have a proposed fix for this problem, but so far none of us are able to
> reproduce it, and so are unable to test.
> Sebastian? Will you help us to test the fix?

Okay, I will do the following:

Today (Friday) I'll make backups.

On Sunday I'll first install the old Ubuntu again to see if the problem persists
anymore. As I said above, the last time I installed Ubuntu from the regular
installer, there was no problem at all. If it's still not happening again, it's
no use testing on my machine (but I can still do it).

Sebastian Breier (tomcat42) wrote :

Sorry to say that, but it was a failure.

1. I made the backups

2. I deleted the old Ubuntu partitions

3. I reinstalled Ubuntu using the original warty installer CD

4. I checked the disk with PMagic => Bad partition table

So far so good.

The problem this time was that I couldn't fix the partition table the way I did
in my first posting, which means changing between LBA/non-LBA mode in BIOS and
making PMagic fix the CHS/LBA and partition size problems didn't help. The
partition stayed broken.

5. Deleted the ext3/swap partitions using Ubuntu's fdisk.

6. Checked the disk with PMagic => No errors. Only my two NTFS partitions and
the free space where Ubuntu was. Somehow, fdisk seems not to be affected by this
bug. Maybe it gets its geometry values elsewhere.

I can't say for sure that the partition table is alright after deleting Linux
with fdisk. So far my data seems alright and no program I use had problems with
the disk. We will see within the next week if fdisk is really capable of fixing
it (by destroying the Ubuntu installation though).

7. Installed Ubuntu onto the free space using the warty-i386-new-parted.iso.

8. Checked the disk with PMagic => Absolutely same problem as with the original
warty installer CD.

Sorry guys... this hasn't worked out.

If this information means anything, PMagic spit out this message the first time

   Disk 3 (114439 MB 14589c 255h 63s) appears to have partitions created using a
different drive geometry (16h 63s).
   This serious problem can lead to data loss.
   No partition manipulations should be made to this disk using this product or
the operating system's products.
   You should back up the data on this disk, delete all partitions, create new
partitions under the new drive geometry, and then restore your data using the

I will still be available for further tests, but be aware that
1. I got a test in about 1 week, so I won't test within that time.
2. making the backups and reinstalling all the things took me about 5 hours
today (have to take out the disk to make the backups in my Dad's PC with enough
free space etc), so if you have further tests, try to enable some log files or
something so we get more data than my reports.

- The proposed fix doesn't work and the problem persists.
- Using Linux fdisk to delete the partitions created by parted (Ubuntu's
ext3/swap) most probably fixes the partition table.

Colin Watson (cjwatson) wrote :

Hmm. There were enough problems listed in the middle of your test log that I'm
not sure we can chalk this up as a definite failure just yet ...

Colin Watson (cjwatson) wrote :

I've uploaded this alleged parted fix from Debian, on the basis that it's very
difficult to get a system back to a reliably testable state after experiencing
the bug, and this change seems to be otherwise safe; I think the best we can do
is watch to see if reports of this problem fall away from now on. I'm
downgrading it away from release-critical, but not closing it, until we know more.

parted (1.6.9-3.1ubuntu3) warty; urgency=low

  * Backport from Debian (closes: Ubuntu #1566):
    - Added backported CHS BIOS geometry fix.
      + libparted/disk_dos.c (read_table, process_bad_chs): now probes
        Microsoft file systems for BIOS CHS geometry. This idea was
        suggested by Steffen Winterfeldt <email address hidden>.

 -- Colin Watson <email address hidden> Tue, 28 Sep 2004 18:39:56 +0100

Chris De Neve (cdn) wrote :

I have also experiencing this bug. Maybe this info can be usefull:
HD was configured like this before install:
part1: 20GB, pri, NTFS (Windows XP)
part2: 20GB, pri, empty
part3: 20GB, log, NTFS (on extended partition)
part4: 20GB, log, NTFS (on extended partition)
During install, I let Ubuntu use the free space in part2 for / and swap. Parted created primary
ext3 partition (+/- 19,5 GB) in part 2, and swap partition (+/- 488 MB). The swap partition
however is actually a logical drive and the extended partition is therefor extended towards the
beginning of the drive. Somehow it has used some faulty drive geometry settings (16 heads instead
of 255 heads). This caused my extended partition to not start at a cylinder boundary, so the disk
shows up as 'BAD' in Partition Magic (while no problems booting Windows XP or Ubuntu Linux). In
Linux, the command 'sfdisk -d /dev/hda | sfdisk --no-reread -H 255 --force /dev/hda' would not
work ('sfdisk: bad input', probably because the cylinder boundaries do not match).
- before install (with correct partition table): create swap partition in the extended partition
- used part2 for /, swap in extended partition
- this still screws up the partition table but can now be corrected with 'sfdisk -d /dev/hda >
parttable.txt' and 'cat parttable.txt | sfdisk --no-reread -H 255 --force /dev/hda' (you will
need to delete the warning messages in parttable.txt before catting it into sfdisk).
I hope this info can help.

Ben (ben-ben-net) wrote :

Just installed the offical release - everything looks good. The new back-ported
parted seems to have done the trick.

Can anyone else confirm?

Matt Zimmerman (mdz) wrote :

There seemed to be mixed reports on the mailing list, but we might be dealing
with more than one bug.

Matt Zimmerman (mdz) wrote :

*** Bug 8288 has been marked as a duplicate of this bug. ***

César GC (cesargcman) wrote :

I have a Dell Inspiron 8500

I had four partitions ...

hda1 -> fat32 (4 Gb)
hda5 -> ntfs (4 Gb)
hda5 -> ntfs (10 Gb)
hda7 -> ntfs (20 Gb)

Two weeks ago i installed ubuntu from iso downloaded from web, when arrive
to disk partition i see my list of drivers correctly, i try to create new
partitions (hda8-> ext3) y (hda9 -> swap) , all aparently go ok... but
after install system i can't access to ntfs hda7, not for linux (ubuntu)
not for Windows XP... i think, well, i have make some extrange election in
partition menu, thinking in to be more careful the next time (i had lucky
because the partition hda7 haven't any important)... From Windows disk
administrator i see the unaccesible partition and thinking it's corrupt
make a format, all ok... but after format, grub boot loader not work...
ups... surprise, i recover boot sector from Windows 98 bootcd and i see the
ubuntu partition it's ... 'i don't know what happens', not exist... i wait
one week to assimilate the incredible fact... and one week later, with news
ilusions... try again... it begin the boot from ubuntu cd and when i go to
menu partitions select partition manual definition, i don't like
information appered, undo selections, don't apply changes!!! and when
reboot without install, i don't understand have dissapered another ntfs
partition...!!!! how it's this possible... i'm not a lucky man this day
because, i have copy from a week ago, but not for things generated this
week... a week work losed... I'm not hacker of linux, but i can define me
how a 'advanced user' and i can't understand how this can be... one user
that decide to probe ubuntu to know a linux option the first time and
occurs this... for this user ubuntu and linux for extension is death...
please, check the repartition system, it's critical fail..., you will think
to show more confirm questions before every action in partition menus or
options... optional will be fdisk form, for advanced users, fdisk won't be
extrange reactions... Please the incredible work of Ubuntu team in all the
Ubuntu Solution it makes, for others, down for this critical fail

Thanks all Ubuntu team...

<email address hidden>

(Sorry for my poor english... i'm spanish). :)

Colin Watson (cjwatson) wrote :

We now have libparted 1.6.19 in Hoary, which is believed by upstream to correct
this problem. Testing is more than welcome; I'll be putting out Array CD 2
shortly containing this version of the partitioning libraries. Note that Array
CD 1 does *not* contain this newer version of libparted.

Colin Watson (cjwatson) wrote :

It's my belief that this issue has been fixed for some time in Hoary due to
upgrading libparted to >= 1.6.12. If a fresh Hoary installation still
demonstrates this problem, I'd like to hear about it.

Colin Watson (cjwatson) wrote :

*** Bug 12032 has been marked as a duplicate of this bug. ***

Hi. I installed Hoary on 03/03/2005. hda1 was NTFS with free space after it. I
made hda2 swap, and hda3 ext3 /. Then I used Acronis Partition Expert to insert
an additional logical partition before the swap partition, while at the same
time converting the swap and ext3 partitions to logical partitions.

I then used ntfstools to resize hda1 smaller, and noticed that there were bits
of unused space (around 6Mb in size) that were not able to be used. After some
time, I deleted the 2nd partition (hda5), and also changed the swap (ext6) and
ext3 (hda7) partitions back to primary ones as this seemed to get rid of the
unuseable 6Mb spaces.

Linux now seems happy with the layout and linux's fdisk no longer complains
about partitions not ended on non-cylinder boundaries (or something like that).
The only problem now is that I can't get NT to boot from hda1 any more.

Upon running Partition Magic within vmware under linux, it gives the same
complaint as mentioned in this bug, with the parition table #108 error.

I'm pretty sure that it wasn't Acronis Partition Expert that caused the problem,
as I've used that many time before for similar operations without it breaking NT.

I think it's quite likely that the problem may be due to ntfs tools (which I
think parted uses...?)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.