Monday, January 10, 2011

Create copy of VM on Proxmox

  1. Ssh into the Proxmox server as root.
  2. Run "vzdump" with desired VMID.
  3. $vzdump 101
  4. Run "qmrestore" with unused VMID. Your dump file should be located in /var/lib/vz/dump.
  5. $qmrestore /var/lib/vz/dump/vzdump-qemu-101-2011_01_10-11_13_30.tar 102
I tested this with a Ubuntu server 10.10 VM.  From the Proxmox console I deleted the network device and recreated it to be sure it had a unique MAC address (not sure if that was necessary).  I started the new VM, logged in, and changed the hostname and some values for the apache server.

**UPDATE (02/09/2011)**
I noticed that when running the this command I would see:
INFO: mode failure - unable to dump into snapshot (use option --dumpdir)
After some intrepid googling I discovered this was because the dump was being created on the same lvm group vzdump had to suspend the vm to do the backup.  To avoid this (since I was backing up a live webserver) I mounted a windows share (on a domain) and pointed the dump to there.

  1. Mount the windows share to the /mnt/share directory (be sure that directory exists)
  2. $mount -t smbfs //server/share /mnt/share -o username=domainuser
  3. Run vzdump with the --dumpdir option
  4. $vzdump --dumpdir /mnt/share/dumps 101