Andrzej Zabost

How (not) to partition your disk

The background

A few months ago I experienced a weird problem while trying to finish some Android development on my Windows-based PC (I was doing it primarily on a MacBook). I have already described it quite precisely on the JetBrains bugtracker here.

Thinking it was system-related issue, I decided to install Ubuntu somewhere on my PC and continue the development using it. Fortunately I had a half-empty HDD with a single partition which I use for some low-spec games and applications (the others reside on the SSD together with the Windows system). I needed about 50 GB of it to be able to setup the system and install the Android development environment and still have some free space for later usage if needed. I could also use the SSD, but I didn’t want to risk any bootloader issues.

The wrong solution

My idea was to use GParted partition editor in order to free 50 GB of the disk and create a new partition for Ubuntu. Of course the easiest way was to shrink the existing partition at it’s end and create an ext4 partition with mount point set to /.

wrong partitioning

So I installed Ubuntu, restarted the PC, chosen the right disk to boot from (ignoring the UEFI boot order configuration) and… got disappointed. The system didn’t start. Instead of the GRUB bootloader, everything I could see was a generic error on a black screen which I can’t remember right now (probably something about the disk or a missing bootloader).

The root cause

Finding out what’s wrong wasn’t easy especially due to my unusual configuration. All the questions and answers I could find involved creating the Linux partition at the start of the disk. That’s why it took me a few long hours to finally (and accidentally) find out that…

Some computers can’t see boot files (/boot) if located far (>100GB) from the start of the disk. This is why it is sometimes necessary to create a separate /boot partition at the start of the disk.

Partitioning done right

So I needed a /boot partition at the start of the disk and now it was going to be a piece of cake – just a few clicks in GParted and my data will be moved 1 GB to the „right” to make space for an additional partition. Well… Yeah, it was easy, but the process took 4 hours (at this point I would like to thank my electricity provider for the uninterrupted power supply). Apparently, you can’t move just 1 GB somewhere else – it moves everything. Luckily I didn’t choose the 3 TB disk for this task.

The final partitioning (which works) looks like this:

Partitioning done right

Lessons learned

  1. RTFM

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.