Server Fault is a question and answer site for system and network administrators. 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 have a / partition which contains /var and is too small. I have another existing partition with enough space.

Here is my df:

File system          Size. Occ. Avai. %Ful. Monté sur
/dev/sda1             5,0G  4,5G  289M  95% /
tmpfs                 242M     0  242M   0% /lib/init/rw
udev                   10M  2,7M  7,4M  27% /dev
tmpfs                 242M     0  242M   0% /dev/shm
/dev/sda2              15G  406M   14G   3% /home

How can I move the /var folder from sda1 to sda2 ?

share|improve this question
up vote 14 down vote accepted

Go into single user mode, and make sure any process writing to /var is stopped. (Check with lsof | grep /var)

  • mkdir -p /home/var
  • rsync -va /var /home/var
  • mv /var /var.old # you can remove /var.old when you are done to reclaim the space
  • mkdir -p /var
  • mount -o bind /home/var /var
  • update your /etc/fstab to make the bind-mount permanent.


 /home/var /var        none    bind
share|improve this answer
Thks! How can I enter into single user mode? Will 'var' folder stay in the /home? – Jérémie Sep 19 '12 at 16:48
Yes there would always be a /home/var directory if you solve the problem this way. One way you can get into single user mode by rebooting, and choosing single user mode from the Boot menu. – Zoredache Sep 19 '12 at 16:51
I am not really sure if this will work fine all the time. If you are using a more recent version (wheezy) you may be OK as it has a /run filesystem. OTOH: early in the boot process files can get opened in /var before it is bind mounted. – cstamas Sep 19 '12 at 17:09
@cstamas, Having /var on a separate filesystem is supported, and always has been. Having /var on a separate is even suggested as being a good thing in FHS, and the official Debian docs. – Zoredache Sep 19 '12 at 17:37
Ok, I think you are right. It was just strange to me to do this with bind mounts. – cstamas Sep 19 '12 at 18:41

You can also use:

 mkdir /home/var
 <move contents of /var to /home/var -- however you want; EX: mv /var/* /home/var>
 mv /var /var.old
 ln -s /home/var /var

This seems a lot easier than messing around with the fstab and mount stuff.

share|improve this answer
Not sure why anyone would have down-vote this. This would work perfectly fine. A sym-link should work fine. I just use bind mounts for other things, so I tend to think of those first. – Zoredache Sep 19 '12 at 19:11
To add to this, it may not be as safe, but it does in fact work. I've recently done this on a machine prior to placing it in production. Iw ould use caution if it's a machine that's been in use or has a lot of processes running. In my case, it was a fresh server meant to run only tomcat. – A.J. Brown Aug 9 '13 at 17:54
Symlinking /var works, but instead of doing so I prefer to put an entry in /etc/fstab, to remember myself on which partition/volume I put what, and why (you can add comments). This way is also more understandable to me what I have to change in configuration if I need to change something in my hardware. – gerlos Mar 4 '14 at 9:15

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.