Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I run a headless ubuntu server from a usb drive, and to minimize writes I want to move the /var folder to a different drive.

The problem is that all other drives are encrypted, and become avaliable only well after boot is finished. I could of course just mount /dev/mapped/drive /var but then I'm sure a lot of processes will get confused as to why their old open file descriptors cant speak to their newly created ones.

Is there a way to basically restart the whole system without having to reboot or do I have to try to figure out which processes are running and /etc/init.d/* restart them manually?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It should be possible but may not be worth the hassle, reboot being the most feasible option.

/var may also contain a database like mysql, various log files and caches. You may have some success doing a lsof | grep /var/ and sending a stop to the related services and most of them may even survive a mv /var /varold && mkdir /var && mount -t auto /dev/whatever /var && cp -Rp /varold /var because they will just stick to their old pid files, but that may crash utterly.

Another approach would be to log in to the server with an account other than root and do a killall -SIGSTOP -u root (or whatever special user they may be running as), do your modifications and resume the processes with killall -SIGCONT -u root.

If this is really mission critical with no downtime and unlimited effort allowance, I would rather setup a cloned virtual machine and mess with that before trying this at the real server.

share|improve this answer

Your Answer

 
discard

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.