A Partitioner's Tale

| |

As you may know, Fedora totally redid their Anaconda installer starting with Fedora 18. There are many reasons for it and I'll not go into that here but one perception out there in Internet land is that the partitioning section of the newer Anaconda installer is a pain to use. I must admit that when I first started using it (installing Fedora 18 alpha and beta releases), I really did not like the changes. This dislike persisted for some time until I finally got used to it. Then time passed. Fedora 19 development started, ran its course, and then Fedora 19 was released. It offered some Anaconda refinements. Now Fedora 20 is approaching its beta release and there are yet more Anaconda refinements.

Since I build my own personal remix of Fedora with the stuff I want pre-installed, I do a lot of installs... to test stuff out. I've definitely gotten used to the newer Anaconda now and I actually like the partitioner. The last time I installed Fedora 17 (to test my last remix build, it has since gone EOL) I actually felt weird using the older Anaconda. I actually prefer the newer one now.

Few people do as many installs as me... and some are still stuck in the "not liking the newer Anaconda" stage. Their main gripe seems to be that the partitioner is very confusing and somewhat broken. I disagree with them and I've been doing some troubleshooting with a couple of problem installs users were having. Turns out their problems had less to do with Anaconda and more to do with having terrible pre-existing partition layouts on their hard drives. I though it might be useful to examine two cases where I have the actual fdisk listings of their partition tables. I'll not mention the names of the users who provided them to spare them some negative attention.

Example one - Let's just jump right in. Here's an image that shows a really poor pre-existing partition table:

Here is a somewhat incomplete fdisk -l listing for it.

Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63       80324       40131   de  Dell Utility
/dev/sda2           81920    20561919    10240000    7  HPFS/NTFS/exFAT
/dev/sda3   *    37459968   204937215    83738624    7  HPFS/NTFS/exFAT
/dev/sda4       307337216   312578047     2620416    f  W95 Ext'd (LBA)
/dev/sda5       307339264   312578047     2619392   dd  Unknown

That almost looks reasonable until one examines the details closely. There is a gap between the end of sda2 and the start of sda3. There is a gap between the end of sda3 and sda4. sda4 (the extended partition) is very small and as a result sda5 (a logical inside of the extended) is very small. What we have here is a bunch of free space but no way to get to it. One can NOT make any additional primary partitions. One can NOT make any additional logical partitions... and to the best of my knowledge... one can NOT make any more extended partitions. All of that free space (> 50GB) is in a virtual no-man's land.

How did this poor partition layout manifest itself in the Anaconda installer? The partitioner said there was plenty of space to install Fedora but whenever you went to actually create partitions / mount points it would give an error about there not being enough room to create said partition. Basically Anaconda was confused by the layout but really didn't have a way to communicate that the layout was unworkable. The end user is left with the impression that Anaconda is horribly broken when it was really a badly mangled pre-existing partition table that was to blame.

Example two - Here's another example of a really poor pre-existing partition layout as witnessed by the complete fdisk -l output.

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x0008cbe0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1       476313598   625137344    74411873+   5  Extended
/dev/sda2           16065   157765631    78874783+  83  Linux
/dev/sda3       160312635   476295119   157991242+  83  Linux
/dev/sda5       602389368   625137344    11373988+  82  Linux swap / Solaris
/dev/sda6   *   476313600   528878053    26282227   83  Linux
/dev/sda7       528891993   602389304    36748656   83  Linux

I wish I had a screenshot of what that looks like inside of gparted but I don't. Just look at the start and end sectors for each partition. sda1 starts somewhere in the middle of the drive. sda2 is near the front. sda5 is after sda7. I don't think there is freespace and if an install is to be done, the user needs to reuse one or more existing partitions.

What did Anaconda do with this? The user reported that the install progress bar just hung at a very low single-digit number. The user just ended up having to power cycle after waiting entirely too long for it to finish when it wouldn't. After rebooting the install seemed to be functional but what exactly happened to make the installer get stuck is unknown. Anaconda gave no indication that there was an issue and did its best to work but obviously got confused.

How did these partition tables get mangled? - For both partition tables, I don't think any sane partitioning program would allow a user to create those partitions on purpose so you really have to ask... how did they get that way? To the best of my knowledge, both users engage in the practice of distro hopping. Distro hopping is where one is interested in using or playing with a different Linux distribution with some regularity. One of those users might be the host of a popular Linux-related podcast who reviews one or more different Linux distros every week... or not. :) But seriously, those partition tables can only be the result of multiple Linux installers, using different methods, strong-arming their way. An odd partition operation to make this distro install... and another one later... and maybe more down the line... and you get a mangled layout. Or at least that is the best explanation I've been able to come up with.

How should Anaconda respond to pre-existing unusable or sub-optimal partition layouts? - It would be nice if Anaconda could play the part of partition therapist and recognize when a user has a really bad partition table that is virtually impossible to work with... and just inform the user in a kind but clear way that they need to fix that before Fedora will install. Historically Anaconda seems to just get confused and error out... thinking that it could do something with it but failing. Can this be fixed? I'm not sure but I hope so. I certainly don't expect Anaconda to figure out methods of fixing the bad partition layouts but they do exist and a small portion of users are going to run into trouble. Luckily I've yet to see a situation where Anaconda makes the situation worse by breaking existing OS installs.

But wait, there's more - It turns out that both users had additional partition related problems.

User one has a Dell laptop that offers a special featured named DirectMedia. Go ahead. Take a little time to read that wikipedia link especially the Design Controversy portion of it. It turns out that the existence of that odd extended / locigal partition combination might just have been the result of MediaDirect... and even if they had been able to install Linux, at some point later when Windows was booted again, MediaDirect would have probably regenerated the problematic sda4/sda5 combination probably breaking any Linux install that was done. Now that takes "Made for Microsoft Windows" to a new and more scary level doesn't it? :(

User two once used dd to backup the contents of one partition to another and as a result had two partitions with the same UUID. As you will recall, one of the U's in UUID stands for unique but in this case it wasn't. Just what confusion might that lead to? They reported on a few occasions that most boots of their computer things were normal but other boots the contents of their home directory would totally change... only to change again next boot. After they figured out that they had two partitions with the same UUID it started to make more sense.

Conclusion - The point is that where there is smoke there is sometimes fire and no Linux distro installer can be a complete fire extinguisher in all situations. Some users have bad partition layouts and it would be a good idea to take that into account. Oh, how about a recommendation... boot your machine with some live media that includes gparted and get your partitions in ship-shape before installing. gparted is more battle tested for partitioning, resizing, etc than any distro's installer. Lastly, the newer Anaconada isn't so bad so get over it! :)