Backup File Names
Newer versions of vzdump encode the guest type and the backup time into the filename, for example
vzdump-lxc-105-2009_10_09-11_04_43.tar
That way it is possible to store several backup in the same directory. The parameter maxfiles can be used to specify the maximum number of backups to keep.
Restore
The resulting archive files can be restored with the following programs.
pct restore
Container restore utility
qmrestore
QemuServer restore utility
Examples
Simply dump guest 777 – no snapshot, just archive the guest private area and configuration files to the default dump directory (usually /var/lib/vz/dump/).
# vzdump 777
Use rsync and suspend/resume to create a snapshot (minimal downtime).
# vzdump 777 --mode suspend
Backup all guest systems and send notification mails to root and admin.
# vzdump --all --mode suspend --mailto root --mailto admin
Use snapshot mode (no downtime) and non-default dump directory.
# vzdump 777 --dumpdir /mnt/backup --mode snapshot
Backup more than one guest (selectively)
# vzdump 101 102 103 --mailto root
Backup all guests excluding 101 and 102
# vzdump --mode suspend --exclude 101,102
Restore a container to a new CT 600
# pct restore 600 /mnt/backup/vzdump-lxc-777.tar
Restore a QemuServer VM to VM 601
# qmrestore /mnt/backup/vzdump-qemu-888.vma 601
Clone an existing container 101 to a new container 300 with a 4GB root file system, using pipes
# vzdump 101 --stdout | pct restore --rootfs 4 300 -
Command to list the running VPSs in a node
# vzlist
Command to list running and stopped VPSs in an node. This command lists all (running and stopped) the VPSs in a node.
# vzlist -a
To start a VPS
# vzctl start CTID
To stop or shutdown a VPS
# vzctl stop CTID
To view the status of a VPS
# vzctl status CTID
To restart a VPS
# vzctl restart CTID
To enter a VPS
# vzctl enter CTID
Delete a container
# vzctl destroy CTID
Suspending a container
# vzctl suspend CTID
Set hostname for a Server
# vzctl set CTID --hostname New_hostname --save
Add new IP to VPS
# vzctl set CTID --ipadd xx.xx.xx.xx --save
Delete IP from VPS
# vzctl set CTID --ipdel xx.xx.xx.xx --save
Reset root password of a VPS
# vzctl set CTID --userpasswd root:new_password --save
To add NameServer IPs to VPS
# vzctl set CTID --nameserver xx.xx.xx.xx --save
Executes commands for a container from node
# vzctl exec CTID command
Example:
# vzctl exec 110 df -h
# vzctl exec 101 df -h
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 130G 89G 27G 78% /
none 8.0G 4.0K 8.0G 1% /dev
none 8.0G 0 8.0G 0% /dev/shm
To check the resource usages
# vzcalc -v CTID
Example:
# vzcalc -v 110
# vzcalc -v 101
Resource Current(%) Promised(%) Max(%)
Low Mem 1.53 182706895112.42 182706895112.42
Total RAM 33.79 n/a n/a
Mem + Swap 1.73 38695649865149.61 n/a
Alloc. Mem 2.95 38695649865149.61 38695649865149.61
Num. Proc 0.05 n/a 2395786836523892.00
——————————————–
Memory 33.79 38695649865149.61 2395786836523892.00
Restoring from a template
#pct restore 103 vzdump-lxc-103-2016_03_15-06_09_03.tar.lzo --storage system_lvms
If PCT Doesn’t work, use LXC commands to control containers
Reboot the container
lxc-stop -n containerNameHere -r
To reboot the container called myhttpd, enter:
lxc-stop -n myhttpd -r
Shut down and kill the container (hard kill)
The syntax is:
lxc-stop -n containerNameHere -k
OR
lxc-stop -n containerNameHere --kill
To forcefully kill and shut down the container called myhttpd, enter:
lxc-stop -n myhttpd -k
To wait TIMEOUT (say 180) seconds before hard-stopping the container, enter:
lxc-stop -n myhttpd -k -t 180
OR
lxc-stop -n myhttpd -k --timeout 180
Clean shutdown (recommended)
The following syntax only request a clean shutdown, do not kill the container tasks if the clean shutdown fail:
lxc-stop -n containerNameHere --nokill lxc-stop -n myhttpd --nokill
A note about timeouts: To avoid waiting up to 60 seconds and simply perform the requestion action (reboot, shutdown, or hard kill) and exit, pass the -W option:
## hard kill ##
lxc-stop -W -n containerNameHere -k
## reboot ##
lxc-stop -W -n containerNameHere -r
To list only running containers, enter:
lxc-ls --fancy --running
To list only stopped containers, enter:
lxc-ls --fancy --stopped
To list both stopped and running containers on the system, enter:
lxc-ls –fancy
Import Disk
qm importdisk <vmid> yourimage.qcow2 namestoragepool
Example:
qm importdisk 101 fileserver.qcow2 local-lvm
LINKS
Cluster control
https://pve.proxmox.com/pve-docs/pvecm.1.html
Cluster Manager
https://pve.proxmox.com/wiki/Cluster_Manager
CEPH
https://pve.proxmox.com/wiki/Manage_Ceph_Services_on_Proxmox_VE_Nodes#_footnote_8
Resize Disk
https://pve.proxmox.com/wiki/Resize_disks