Backup option in VM disk properties

WIld_Tigra

Member
Mar 12, 2019
3
0
21
47
Good afternoon, please tell me what command I can use to turn this option on and off besides the GUI. I want to create a task in the crown to turn on and off one disk, so that once a week I can make a full backup of the VM with the contents of this disk, and on all other days without it.
 

Attachments

  • 0001.JPG
    0001.JPG
    39.7 KB · Views: 10
This should give you a direction to follow:

Code:
root@pve7demo1:~# qm set 101 --scsi0 $(qm config 101|grep scsi0:|cut -f2 -d" "|sed 's/backup=1/backup=0/')
qm set 101 --scsi0 bb-iscsi:vm-101-disk-0,backup=0,size=2G
root@pve7demo1:~# qm set 101 --scsi0 $(qm config 101|grep scsi0:|cut -f2 -d" "|sed 's/backup=0/backup=1/')
qm set 101 --scsi0 bb-iscsi:vm-101-disk-0,backup=1,size=2G

PS
A smaller line: qm set 101 --"$(qm config 101|grep scsi0:|sed 's/backup=0/backup=1/')"
The backup= must already be set, if its not there - you need to make your script smarter.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
  • Like
Reactions: WIld_Tigra
I applied your option, the command passes, it says the disk configuration in the virtual machine has been updated, but if you go to the parameters, the backup option is not disabled.

Code:
~# qm set 103 --virtio1 $(qm config 103|grep virtio1:|cut -f2 -d" "|sed 's/backup=1/backup=0/')
update VM 103: -virtio1 local:103/vm-103-disk-1.qcow2,size=2G
 
The backup= must already be set, if its not there - you need to make your script smarter.
The default is for disk to be backed up. Because its the default - it doesnt need to be in the config.
The UI simply removes the options when you enable it. If the backup setting is not on the disk line - its enabled.

So you have to be careful when making changes from various interfaces. The example sed replacement only works if the disk line contains either backup=0 or backup=1, however if you modified it from UI - it might not.
The example that I provided will do nothing if the backup text is not present.

the pseudo code for the workflow would be something like this:

var id
var device
var action

if action is enable and if output of config for device does not contain text "backup" , its already enabled
if action is enable and if output of config for device contains backup, replace backup=0 with backup=1
if action is disable and if output of config for device does not contain text "backup", add backup=0 to string on set
if action is disable and if output of config for device contains backup, replace backup=1 with backup=0

good luck


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!