I have a system which completely resides on a (relatively small) single harddrive (/dev/sda). Now I am expecting to /var/lib/ to become populated with more and more files (due to using lxd containers) and therefore I want to shift that to another hard drive or partition which I am adding to the system.
2 methods come to mind and I'd like to get some advice from a little more experienced people which one to favor
METHOD A - symlink
- sudo cp -a -r /var/lib/ /mnt/new-hd/
- sudo mv /var/lib /var/old-lib
- sudo ln -s /mnt/new-hd/lib
METHOD B - mounting new folder over existing /var/lib
- sudo mnt /dev/new-hd
- /mnt/temp sudo
- cp -a -r /var/lib/* /mnt/temp
- sudo umount /mnt/temp
- create fstab entry for /dev/new-hd (to be mounted to /var/lib)
- sudo mount -a
looking at it now. I'm in favor of METHOD B slightly. Any comments?
In my usecase it's about lxd, so I am also wondering whether shifting the entire /var/lib is the best choice for this or should I only move the relevant parts? Mocing the entire /var/lib has the advantage to have a structure which is very similar to the default (and therefore less custom things to be aware of)