Saturday, 31 January 2009

Moving /home to another partition in Linux

Warning: Please note that these instructions are for an Eee PC 901 with 2 internal SSD's, a 4GB and a 16GB. If your PC has a different setup these settings may not work. These instructions are from memory and I can not be responcible for any data loss you may suffer from following them - use at your own risk!

After a couple of days of messing around with other OS's on my Eee PC I have reverted back to Cruncheee. Actually it is RC2 of Crunchee!

While playing with the other options I have been very careful not to install anything on the second SSD inside the Eee PC as this houses my original /Home partition with all of my custom settings since my last Cruncheee install. Looking back I have realised that I never posted instructions on how to move your /home partition to the second SSD so here they are:

First and formost you need to move your existing /home data to the second SSD. Make sure your second SSD is mounted already by checking your /media directory. In here there shoud be a folder called 'disk'. If not follow these instructions:

1) Go to your /dev directory > cd /dev

2) List the available drives > ls sd* > this should output sda sda1 sda2 sda5 and sdb sdb1. Your second SSD is sb1 (at least mine was!).

3) Create a folder in /media to mount the drive > sudo mkdir /media/disk

4) run > sudo mount /dev/sdb1 (or the name of your 2nd SSD) /media/disk > to mount the 2nd SSD to /media/disk.

From here you can log out of your 'windows' session. When prompted o log in if you click the Options button in the bottom left you should be able to select Choose Session then select Failsafe Terminal. Then proceed to log in with your normal username and password.

This should log you in to a terminal only session and from here you can move your existing home folder to your 2nd SSD with this command:

sudo cp /home /media/disk/

This should copy the contents of your /home folder to the 2nd SSD. Once complete, it can take a while, you need to edit your fstab so it mounts your new /home correctly:

sudo vim /etc/fstab

and add the following 2 line to the bottom:

# /dev/sdb1 for /home
/dev/sdb1 /home ext3 rw,user,exec,relatime 0 0

write and quit this file and reboot your machine. Once rebooted you should find that your /home directory is located on your 2nd SSD giving you lots more space to store files!

Note: there is some debate about the need to add relatime as it is not proven that SSD's will suffer more than a normal HD as a result of continuous writes - Article.

Assuming this was successful you Will not want to go back and remove your 'old' home directory. To do this you will need to edit your fstab and comment out, with #, the lines you added above. Then reboot your PC. Log in to the failsafe terminal again and insure that the files in the /home directory are your old ones then you can safely remove them. Then edit your fstab to comment those lined back in and reboot your machine and log in normally, Voila you have moved your /home directory to your more spacious 2nd SSD.

blog comments powered by Disqus