1

I'm running Ubuntu 10.04 and I would like to move /var to another partition using a python script. I found some directions that I thought were pretty good, but they call for switching to runlevel 1 (single-user mode) to prevent changes to /var while it is moved.

Is switching the runlevel necessary? Do I just call os.system('init 1') directly in my script? Can I put the system back in its normal state just by calling os.system('init 2') after the script is done?

When I'm connected over SSH I get booted out when I run init 1 myself, even if I'm connected as root. If I'm at the keyboard when I do init 1 I get the message: Will now switch to single-user mode, Give root password for maintenance (or type Control-D to continue):. My root password does not work at that point so I've tried Control-D and logging in as a user. runlevel then says the system is back at runlevel 2, but I can't reconnect by SSH until I reboot the system.

Any help understanding what is going on is appreciated!

1 Answer 1

1

For moving /var as a whole, I'd recommend booting from a live CD (or USB) unless you're very confident in what you're doing (and if you were, you wouldn't be asking this question).

Separating /var isn't particularly useful anyway. If your / partition is almost full, look for a large directory or two that you can move away more easily, such as /var/www or /var/mail or /var/cache. Oh, and run apt-get clean to make sure you're not worrying over a large amount of downloaded and installed .deb packages.

1
  • It's a web server on a virtual host, so I'm wary of overflowing log files and such. I don't think I would be able to do the live boot. Thanks for the tip on apt-get clean though. Commented Oct 25, 2011 at 0:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.