I currently only have remote access to this CentOS box, I need to move /var form the primary RAID to a new set of disks that was installed with more space, My current thoughts on how to accomplish this is to temporarily mount the new RAID to /tmp/var. rsync everything from /var to /temp/var then modify the fstab to point /var at the new disks.
Here is my question. how do I delete the existing /var on the primary disks once I have the new disks mounted to that location (assuming this is even possible remotely)?
This is a non trivial task on a running system. The
/var
tree has many open files that are continuously being written to via an open fd. These files will remain open on the original device until you tell the daemon to close and reopen it's log file. If you are using mysql and are using it's default datadir then you will need to make special provision for this too.will give you some idea of the scale of your task. Each of those files will require some action on your part to move to the new device. Some (most?) of the daemons will just require a
kill -HUP
or aservice servicename restart
to get them to close and reopen their files others will require more effort e.g. mysql in default config.You may end up having to wait till you can restart the system to be able to recover the old
/var
entirely.This might be a little tricky on a live system, I'd do a switcheroo approach:
Naturally you'll want to make sure your fstab is updated to have this persist on boot.