BACKUP:
-----------
Command for backup is 'vzdump'. Which having below flags.
]# vzdump <options> <CID>
--exclude <CID> Assumes --all
--all Backup all VPSs.
--compress Compress backup with tar.gz/tgz format.
--dumpdir <DIR> Stores dump in specified DIR. Default directory is /vz/dump.
--tmpdir <DIR> Store temporary files in DIR. --suspend and --stop are using this directory to store a copy of the VM.
--stop Stop/start VM if running.
--suspend Suspend/resume VM when running. This is used for minimal downtime.
--mailto <EMAIL ID> Send notification mail to EMAIL. You can use this option more than once to specify multiple receivers.
Examples:
]# vzdump --suspend --compress --dumpdir /backups/tlv1/2013-Jan-10 --mailto audit@example.net 4002 [at office]
]# vzdump --compress --stop 101
]# vzdump --compress --stop --all
]# vzdump --suspend --exclude 101
]# vzdump --suspend --compress --dumpdir /backups/ --tmpdir /tmp --mailto audit@rootuser.in 101
RESTORE:
-----------
]# vzdump --restore <DUMP DIR> <NEW VPS ID>
Example 1:
vzrestore /backup/2015-Apr-22/vzdump-openvz-112-2015_04_22-15_58_05.tgz 113
Assume that the VPS (101) is damaged, So I need to restore it on same HW node.
]# vzctl stop 101 [Stop Existing VPS]
]# vzdump --restore /backups/vzdump-openvz-101-2012_11_26.tgz 1001
Here, 'vzdump-openvz-101-2012_11_26.tgz' is backup/dump and '1001' is new un-used VPS ID. You may also use CID 101, For this you need to move/delete existing 101 container and its configuration files.
]# vzctl start 1001
Example 2:
Assume that I want to clone VPS 101.
]# vzdump --restore /backups/vzdump-openvz-101-2012_11_26.tgz 1001
Here, 'vzdump-openvz-101-2012_11_26.tgz' is backup/dump and '1001' is new un-used VPS ID.
]# vzctl set 1001 --ipdel 10.20.30.10 --save
]# vzctl set 1001 --ipadd 10.20.30.15 --save
]# vzctl set 1001 --hostname new.rootuser.in --save
]# vzctl start 1001
Thats it...
No comments:
Post a Comment