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.

== BEFORE INSTALL ==

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.

== THE PROBLEM ==

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.

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.

== CONCLUSION ==

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. ;)

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.

(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).

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
today:

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
backup.

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.

== SHORT CONCLUSION ==
- 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.

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.

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).
Workaround:
- 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.

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
possibility...

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.

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...?)