So this happened while I was setting up my Arch Linux installation on Virtualbox. While installing LightDM I got an error saying there isn’t enough space in my / (root partition mounting point). My setup for the drive partition was :
I soon realised my mistake , I needed more space in my root partition but Virtualbox won’t allow me to increase the hardisk size. The only option would be to repeat the entire process ,
create a virtual machine with a larger hard drive --> install Arch.
I was looking for a smarter way to avoid repeating the entire procedure. Based on a hunch I created a new hard drive NewVirtualDisk.vdi for the Arch installation :
The new hard drive was mounted as
/dev/sdb. My plan was to move the /home partition to the 8GB volume and give the entire 5GB to the / partition . This way both the root and home will have good amount of space.
The first step was to format the raw 8GB volume into ext4 and make a primary partition in it :
The new partition looked like this :
Great now I had my hard drive and partitions ready, next step was to safely mount
/dev/sdb1 instead of current
Here comes the interesting part, for making changes to the mounting point of /home we need to first edit the
fstab file which we generated during our installation.
The fstab or File Systems Table is a system configuration file that typically lists all available disk partitions indicating how they are to be initialized or otherwise integrated into the larger file system structure. It is read by
mount command, which happens automatically at boot time to determine the overall file system structure.
fstab is found at
/etc/fstab and can be set up in two modes , either using the uuid or label of the partitions. Both the label and uuid info of partitions can be found by :
To make changes to fstab one needs root priviledges :
In the fstab, we have to replace the label or uuid of
/home mount point section. This is how my fstab looked like after the changes :
As can be seen ,
/home is now supposed to be mounted on
Now since the
mount command reads
fstab just a single unmounting and remounting process will mount
/home correctly onto
/dev/sdb1 but we need to change to
/ before we can unmount/mount
/home because you can’t unmount the file system you are currently in.
lsblk now showed
/home is correctly mounted on
/dev/sdb1 but there was an issue, when I tried changing to my home directly it threw an error.
This error took me quite long to understand. What this meant was there was no
sanad directory in our new
/home. This was because the installation was done on sda2 and the entire folder of user
sanad was there. What to do now? Simple, Copy all the contents of the folder from the other partition ! (by the way this was a hunch)
First I needed to mount the previous partition
/dev/sda2 at a temporary place. Google helped me find that
/mnt is used for the very same purpose.
The above did the trick. The new
/home had all the settings , data of the user
sanad. Everything should work fine right? This time when I tried to CD to home I got another error :
This was because I didn’t had enough permissions to read/execute/write to the
sanad folder. A simple setting of
permissions fixed it.
cd took me to my home directory and I was able to use it normally :)
This is how the setup looked like after the last step:
This was just the first step, now the next steps would be :
1) Delete the partitions
sda1 to use entire 5GB volume (by maybe using chroot and fdisk)
3) Resize the file system for the new size of the partition ( maybe resize2fs).
P.S. : I would like to thank amazing Arch Linux Community and OracleVirtualBox Team and Community for all their support. You guys rock! I am learning a lot by this method of self exploring because of DIY nature of Arch , thanks for that too.
Till then, stay tuned and Happy Hacking!
For corrections/suggestions : firstname.lastname@example.org