PDA

View Full Version : How to free up /vz space if its full, how to move?



Fli
04-22-2013, 11:23 PM
THIS MANUAL CAN CAUSE YOUR SERVER DATA LOSS IF YOU DONT KNOW WHAT YOU ARE DOING

Hi,

if You are running HyperVM or other OpenVZ virtualization, you may created small / partition (default size of Linux partition / is like 10GB)

But OpenVZ files are located right on this small partition in /vz . This folder takes up too much space (mainly OS templates and VPS folders itself).

If you have small (like 10GB) / partition, i highly recommend moving /vz to Your /home folder, because your /home mount can have more space. (You should check that first by command "df -h")

Do this move ontime before you have many VPSes, as you will need to stop them all in order tome /vz folder.

following command shows how much /vz uses (can take long time if you already created virtual machines)

du -h /vz --max-depth=1

Also note that for moving /vz which contains your running virtual machines data, you may need to stop all virtual machines and then move, then make so called symbolic link from /vz to /home/vz, so everything old linked to /vz is redirected to /home/vz ; then start VMs again. I used this command to do it:

service vz stop;mv /vz /home;ln -s /home/vz /vz;service vz start

You should now check if VMs and eveything runs properly.

To revert the process: (stop openvz, remove symlink, move back from /home/vz to /vz, start openvz)

the command:

service vz stop;echo "Now remove symlink? If its a directory, its probably NOT symlink so dont remove it\!;rm /vz;mv /home/vz /vz;service vz start


----

To delete symbolic link, just delete symbolic link file (like you moved /vz to /home/vz so you can delete /vz by command "rm /vz". but if you dont know what are you doing, rather rename it first by command "mv /vz /vz.old"... deleting accidentally all your virtual machines data would be really expensive fault)

you can also move /vz folder back by command: service vz stop;mv /home/vz /vz;service vz start
make sure you remove symbolic link first