Watch out when you move /var in Ubuntu

June 14, 2007 – 19:20 | Ubuntu

When I was installing my Ubuntu, there was this part where an experienced admin would spend some time devising a plan for which part of file system should be mounted from which partition. I decided to skip it and kept everything except /home on one single partition – just to keep it simple. Well, at an unfortunate moment during the past weekend, it suddenly hit me that I should stop being such a noob, and “make things proper”.

So I fired up gparted and broke a fat32 partition into a few ext3 ones. Reboot… enter single user mode… move /opt, /tmp, and /var into their respective parition… edit /etc/fstab… reboot. Voila! df confirms exactly what I had planned for, except…

Except the networking is completely down – “completely” as in “even the loopback 127.0.0.1 interface isn’t up”.

Rebooting with “nosplash” showed some peculiar messages:

Mount point “/var/run” does not exist. Skip mounting.
Mount point “/var/lock” does not exist. Skip mounting.
(and later)
/var/run/network does not exist…

After a bit googling, I ran into Chris Siebenmann’s wiki page on how Ubuntu requires /var/run to stay on the root file system even though /var is relocated to somewhere else. Among his comments, I found this particular sentence amusingly depressing (well at the moment it was just “depressing”):

If you started out without a separate /var filesystem and now want to move to one, apparently your life just sucks.

Eventually I fixed the problem by entering the single user mode, umounting /var, and manually creating /var/run and /var/lock in the root file system.

Trackback from your site, or follow the comments in RSS.
  1. 7 Responses to “Watch out when you move /var in Ubuntu”

  2. I had the same problem. Thank’s for great advice! :)

    By Bobo on Jul 22, 2007

  3. Thanks. I was just about to put /var on another partition. But I thought it would be a good idea to google Ubuntu and moving /var partition first.

    By Chris on Sep 1, 2007

  4. I was ready to go ahead and do what you had originally done, when I stumbled on your website. Thanks for the tip – it will save me a lot of time!

    By Wayne on Oct 27, 2007

  5. I ran into this issue and stumbled on your site. Thanks for the tip!!

    By ChrisW on Mar 30, 2010

  6. You’re a lifesaver. I’ve been running into this issue for the last few hours, and could not for the life of me figure out the problem.

    By Sam on Sep 20, 2011

  7. I was just about to move /var. With all the other issues I’ve had moving things in 11.04… I googled & thank you for saving me another huge headache of errors!

    By Ryan on Oct 13, 2011

  8. Thanks for your post, but since I’m using Ubuntu 12.04, moving /var was a breeze.

    /var/run and /var/lock are now symbolic links to /run and /run/lock respectively.

    By Mani on May 11, 2013

Post a Comment