Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to store /var on a separate partition from /. What is the correct way to set this up?

share|improve this question
up vote 12 down vote accepted

First prepare a new partition (e.g. with parted and mkfs).

Say the partition is /dev/sda5

Mount the new partition:

mkdir /var2
mount /dev/sda5 /var2

Sync your current var:

rsync -a /var/ /var2

Add the entry to /etc/fstab

/dev/sda5    /var    ext4    defaults      2 2


If you happen to need to go back you your old /var just comment out the entry in fstab.

share|improve this answer
I would add some information to recover the space on the old /var: start from a livecd, mount the partition on the installed system / and rm -rf /var/*. – enzotib May 3 '11 at 5:06
Good point. Or you can mount / to some other location on the current system while it's running (but after rebooting). Then you can get at the old /var and delete it if you like – Aleksandr Levchuk May 3 '11 at 23:32
I used to wonder about those too. The first 1 is something really archaic and effect-less, the second one controls the order of fsck's when it's time to scan your ext during boot. I don't pay attention to them anymore. Just put 1 1 because the syntax requires it. – Aleksandr Levchuk May 4 '11 at 3:04
You should put 2 2 to let things like / get fsck scan before /var when you reboot the 30th time. Otherwise if /var fails and asks you to fix things manually in a single user shell - then you will not have any filesystem. Fun stuff. – Aleksandr Levchuk May 4 '11 at 3:27
Isn't the recommendation to use UUIDs in fstab? I got the appropriate one using blkid -o list -s UUID, but I think you need to run with sudo – steevc May 27 '12 at 11:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.