2

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?

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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