Saturday, September 21, 2013

moving one vm from one disk to another disk

Moving your openVZ container from one disk to another disk in the same server.

That is moving vm locally on the server. Normally we are doing this when your current Hard disk space is over.

Let say the new disk is mounted on your server as disk2

We are trying to migrate a vm (2013 CTID) to disk 2

1. cd /disk2/
mkdir private
mkdir 2002
2. cp -a /var/lib/vz/private/2013/* /disk2/private/2013/

3. vzctl stop 2013   => stop the vm

4. vzquota drop 2013  => drop the quota , otherwise you will find some quota related issues.


Then edit the config file and enter the new VE_PRIVATE value,

5. vi /etc/vz/conf/2013.conf

VE_PRIVATE="/disk2/private/2013"  

6. mv /var/lib/vz/private/2013  /var/lib/vz/private/2013.bak  //taking backup to restore if needed, once successfully you can remove this file

*Start the vps

7. vzctl start 2013

No comments:

Post a Comment