I have some unused space on my disk, and decided to use a little of it to create a separate /var partition. There might be an easier way to do this, but my idea is to
- copy the existing /var directory to the partition;
- mount the partition over the existing /var directory;
- using another system, either another distro on the disk or a live CD, to delete the original /var contents while the partition is not mounted.
I've done the first 2 steps, and it seems OK so far. I've made an entry in fstab to mount on boot, which I'll test before deleting. But I'm wondering if this is a valid strategy, and also if it's a good idea and/or if there is a better way. It's somewhat of a learning experience for me to play around more with mounting beyond the basics.
Thanks to the suggestions below, I completed step 3 without the need to use a 2nd system. The method I used was to remount the root fs using the command
mount --bind / /mnt/temp, then going to
/mnt/temp/var and deleting the files and directories there.
The one suggestion made after I did it was to create a dummy file, and then check the mounted /var directory to confirm that it was not seen in that directory. But I compared timestamps to see that they were different, so I felt confident that I was OK.
Thanks for the suggestions, everyone.