Proxmox Backup & Restore

From QmailToaster
Revision as of 07:55, 2 April 2024 by Ebroch (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Back

Backup VM (default, snapshot)
# vmid=120
# vzdump $vmid
  INFO: starting new backup job: vzdump 120
  INFO: Starting Backup of VM 120 (qemu)
  INFO: status = stopped
  INFO: update VM 120: -lock backup
  INFO: backup mode: stop
  INFO: ionice priority: 7
  INFO: VM Name: qmt.devel.maria.rhel8
  INFO: include disk 'scsi0' 'local-zfs:vm-120-disk-0' 10G
  INFO: creating archive '/var/lib/vz/dump/vzdump-qemu-120-2019_04_03-14_16_37.vma'
  INFO: starting kvm to execute backup task
  INFO: started backup task '0cdb7e22-c106-4ebe-ab69-9c0510aa8e74'
  INFO: status: 1% (139591680/10737418240), sparse 0% (1327104), duration 3, read/write 46/46 MB/s
  .
  .
  .
  INFO: status: 100% (10737418240/10737418240), sparse 53% (5792219136), duration 364, read/write 315/22 MB/s
  INFO: transferred 10737 MB in 364 seconds (29 MB/s)
  INFO: stopping kvm after backup task
  INFO: archive file size: 4.61GB
  INFO: Finished Backup of VM 120 (00:06:08)
  INFO: Backup job finished successfully

Restore VM
# cd /var/lib/vz/dump
# qmrestore vzdump-qemu-120-2019_04_03-14_16_37.vma $vmid
  restore vma archive: vma extract -v -r /var/tmp/vzdumptmp5665.fifo /var/lib/vz/dump/vzdump-qemu-119-2019_04_03-14_44_05.vma /var/tmp/vzdumptmp5665
  CFG: size: 406 name: qemu-server.conf
  DEV: dev_id=1 size: 10737418240 devname: drive-scsi0
  CTIME: Wed Apr  3 14:44:06 2019
  new volume ID is 'local-zfs:vm-126-disk-0'
  map 'drive-scsi0' to '/dev/zvol/rpool/data/vm-126-disk-0' (write zeros = 0)
  progress 1% (read 107413504 bytes, duration 1 sec)
  .
  .
  .
  progress 100% (read 10737418240 bytes, duration 23 sec)
  total bytes read 10737418240, sparse bytes 9387278336 (87.4%)
  space reduction due to 4K zero blocks 3.79%
  rescan volumes...

Restore VM to particular location
# qmrestore vzdump-qemu-120-2019_04_03-14_16_37.vma $vmid -storage local-zfs-2 -pool mzpool

Move Disk
# qm move_disk <vmid> <disk> <storage> [OPTIONS]
# qm move_disk vmid disk-type new-storage option
Move vm 121's scsi0 disk to storage local-zfs-2 and delete disk from previous storage location
# qm move_disk 121 scsi0 local-zfs-2 -delete