PDA

View Full Version : [all variants] Moving /home to a separate partition



AlanQ
October 8th, 2009, 03:26 PM
I was asked a question about this in another thread.
As it was getting a bit off-topic, I decided to post my answer here.

There seem to be several threads about this topic but they all (of course I haven't read them all) seem to be specific to one or other person's problem.

This is my attempt at a more generic post on the subject.
Corrections, etc most welcome.

Putting /home on a different partition

The biggest advantage is that it allows you to upgrade/re-install the OS without having to re-install your user files in your home directory.

If you do it at the time of installation, it's easy :)

Moving /home at a later date is not for the faint-hearted but it can be done.

Because the process involves modifying a system that you are on (like cutting the branch you are sitting on) at some point you will need to either drop the system to single-user and do most of it as root or, if you're not an expert or you simply like an easier life, do it from a live CD.

The following is intended as a simple check list -- don't rely on it alone, read other references first and make your own plan.

The main stages of the process are [software in brackets]:

Take a complete copy (backup) of your current /home [cp -a or rsync]
Re-partitioning a disc can damage the data on it so, take a complete copy/backup of everything else of value on the disc and, to be extra safe, defragment any Windows partitions.
Create the new partition [GParted or cfdisk or fdisk]
Format the partition [GParted or mkfs.ext3]
Mount the new partition and copy to it the backup of /home
Move the current /home to /old_home [mv]
Modify /etc/fstab so that the system will see and mount the new partition as /home when it boots


There's an old but very good reference for this at http://www.ibm.com/developerworks/library/l-partplan.html .
There's also an Ubuntu help page, which points to two other references, here: https://help.ubuntu.com/community/Partitioning/Home/Moving (with some edits as people discovered the gotchas :) ).

NB (for everyone reading this and any other post giving technical advice/instructions) Always make sure you understand what you are doing before you do it: if I've made a mistake or forgotten something here, it's merely embarrassing for me; if you implement my mistake, it's potentially big data loss for you. Read other references. Read the man pages.

Good luck.

zvacet
October 9th, 2009, 05:31 PM
This (http://psychocats.s465.sureserver.com/ubuntu/separatehome) is good guide for making/moving separate home partition.