Extending Partitions in Ubuntu (SSD+HDD) - A Struggle Story

Extending Partitions in Ubuntu (SSD+HDD) - A Struggle Story

Do's and Don'ts

Yesterday I got over with one of my few exhausting nightmares. Yes, it was extending my Ubuntu's root and Home partitions because I, for some reason god knows why, gave it a space of 24GB only. For starters that could do fine, but not when you are a newbie in Linux and don't have any idea where the files are installed and end up having huge things like Android Studio, AVD (Android Virtual Device) inside of it. Not only that, my Home partition was of 45GB only. So yeah, the Valentine just got more fun with a voice near you screaming "I need space". I got to use many things, even the TTY3 terminal (not sure whether to call it a terminal as no terminal can look so scary, and why does it have to get closed using Ctrl+Alt+f1. Was Alt+f4 taken? damn!).

When you have an SSD and an HDD, you would definitely want to use the SSD for bootloader installation (at least). I came across multiple solutions but ended up having a hybrid of them. The solutions were:

  1. Make a partition in HDD and copy (or move) the /home directory to that partition.

  2. Create backup of your files, reinstall Ubuntu with /root in an SSD partition while /swap and /home inside the HDD.

  3. Cry T_T (Best and easy, trust me. You postpone whatever you're gonna do right now and just free up the storage again when you run out of space. Then try to find out a permanent solution, why? when you can always cry. However, the lot of us are taught something - "Don't Repeat Yourself". so...OOPs, DRY and...whatever)

I have used the Hybrid solution for my problem, 1 and 2 (Wasn't aiming for but you know...Trick Shot).

For Step 1, I watched this video till the end, but was only able to follow till 09:35 as after that, the disaster struck.

I had to open TTY and delete my original /home directory. Yes I was able to switch back to Ubuntu desktop from the TTY but a fair warning: DO NOT OPEN THE FILE MANAGER FROM YOUR DOCK, BECAUSE YOU HAVE JUST NOW DELETED YOUR /home PARTITION AND IT WOULD BE HEARTSTABBING FOR YOUR OS. What happens if you open your file manager at that point? Your Ubuntu will crash or the screen will freeze, you'll have to restart the PC and BOOM! It showed me The Welcome Screen you get after a fresh installation of Ubuntu :) I was definitely understanding the issue, but...after having it :D

Logically, after rebooting, your Ubuntu comes back to life knowing that it has the /home directory in the same place (partition) which was assigned to it at the time of installation. But then finding no data or indexes in it, Ubuntu reboots with an empty /home identifying itself as a new and fresh installation (+10 Wisdom Points to Ubuntu). Simply put, your settings have been reset and your files are lost! Then I tried deleting the /home again with the TTY (why again? I just wrote...rebooting made Ubuntu think that it had a /home directory already), but yep...everything got a lot messier. At this point it was already popping in my head that if deleting /home can reset the settings in my OS, then reinstalling a fresh Ubuntu with a new /home directory that I just made (or copied; in my case the partition was dev/sdb2/) from my original previous /home can restore my settings and obviously, my files too T_T (Always safer to make backups guys, I didn't make it because I think we should take risks...and then cry).

So, I switched to my Windows, created a bootable USB of Ubuntu 20.04 LTS using Rufus, and reinstalled Ubuntu. I gave 45GB to the /root partition, 7GB to the /swap and then 110 gigs of pure ext4 partition was waiting for me to use it as my /home. Also, If you have come this far like me then MAKE SURE FORMAT isn't checked for /home.

I booted for the first time in my newly installed Ubuntu and Voila! My old desktop wallpaper was there, my dock was already customized and the /home was now 110GB instead of 45 with all of my files in it (T_T). So, a happy ending indeed.

PS: Obviously I'll be posting code related stuff but as a first post I thought I should post something random. Also, I am a Backup guy. I don't even trust git (sorry Linus). I backup a file which I'm doubtful of getting conflicts. Oh, and FYI, nobody said "I need space". I am in a healthy relationship because I don't celebrate Valentine's (no Offense people XD, peace out). Thanks for reading.