Back Up and Restore OpenVZ VMs With vzdump on CentOS

Pertama anda perlu melakukan instalasi vzdump

# yum install vzdump rsync

Kemudian membuat folder dimana hasil dump di simpan

# mkdir /home/backup

Dump Proses

# vzdump --compress --dumpdir /home/backup --stop 101

INFO: starting backup for VPS 101 (/vz/private/101)
INFO: starting first sync /vz/private/101 to /home/backup/tmp23139
INFO: stopping vps
Stopping container ...
Container was stopped
Container is unmounted
INFO: final sync /vz/private/101 to /home/backup/tmp23139
INFO: restarting vps
Starting container ...
Container is mounted
Adding IP address(es): 211.98.195.101
Setting CPU units: 1000
Setting devices
Configure meminfo: 118882
Set hostname: test.net
File resolv.conf was modified
Setting quota ugidlimit: 3000
Container start in progress...
INFO: vps is online again after 55 seconds
INFO: Creating archive '/home/backup/vzdump-101.tgz' (/home/backup/tmp23139/101)
Total bytes written: 1230428160 (1.2GiB, 3.5MiB/s)
INFO: backup for VPS 101 finished successful?  (13.42 minutes)

Restore Proses

# vzrestore /home/backup/vzdump-101.tgz 124

INFO: extracting archive '/home/backup/vzdump-101.tgz'
INFO: extracting configuration to '/etc/vz/conf/124.conf'
INFO: restore successful

Dimana 124 merupakan VEID untuk vps baru

Jalankan VEID

#vzctl start 124
Starting container ...
Initializing quota ...
Container is mounted
Adding IP address(es): 211.98.195.101
Setting CPU units: 1000
Setting devices
Configure meminfo: 118882
Set hostname: test.net
File resolv.conf was modified
Setting quota ugidlimit: 3000
Container start in progress...


# vzlist -a
CTID? ? ? ? ?  NPROC STATUS?  IP_ADDR? ? ? ? ? ? ? ?  HOSTNAME
124? ? ? ? ? ? ? ?  43 running 211.98.195.101? ? ? ? ?  test1.net

Anda dapat melihat VEID asalnya 101 menjadi 124

Untuk menseting hostname lakukan perintah berikut

#vzctl set 124 --hostname test2.net --save

Untuk menseting ke IP baru, perlu menghapus ip lama dulu

#vzctl set 124 --ipdel 211.98.195.101 --save

Sekarang add IP baru

#vzctl set 124 --ipadd 211.98.195.103 --save

Jalankan VEID

#vzctl start 124


# vzlist -a
CTID? ? ? ? ?  NPROC STATUS?  IP_ADDR? ? ? ? ? ? ? ?  HOSTNAME
124? ? ? ? ? ? 43 running     211.98.195.103 ? ? ? ?  test2.net

Was this answer helpful?

 Print this Article

Also Read

Install and manage iSCSI Volume

Internet SCSI (iSCSI) is a network protocol s that allows you to use of the SCSI protocol over...

Set Up an NFS Storage on CentOS 6

About NFS (Network File System) Mounts NFS mounts work to share a directory between several...

Install iptables di server master

Pertama-tama Anda harus menentukan iptables modul yang tersedia. Edit...

Test Benchmark Server

Jalankan perintah berikut untuk melihat hasil. wget https://www.hostnic.id/downloads/bench.sh -O...

Turning On and Off Quotas for Container

The parameter that controls the second-level disk quotas is QUOTAUGIDLIMIT in the Container...

Powered by WHMCompleteSolution