This commit is contained in:
2025-10-12 13:20:31 +02:00
parent 936ed2227e
commit 6fc22a8ee0
2 changed files with 16 additions and 0 deletions

View File

@@ -8,20 +8,31 @@ Find the VM you want to move, then go to the Hardware tab. Mark each drive and u
## Move using the CLI ## Move using the CLI
### List available datastore
- Get VMID from VM list: `qm list`
- Get all datastores: `pvesm status`
### Example bash script: ### Example bash script:
``` ```
#!/bin/bash #!/bin/bash
# Get VMID from VM list: qm list
# Get all list of datastores: pvesm status
myvmid=$1 myvmid=$1
datastore=$2 datastore=$2
echo *** echo ***
echo Moving $myvmid to $datastore echo Moving $myvmid to $datastore
echo
for vmid in $myvmid; do for vmid in $myvmid; do
for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do
echo Moving: vm-$vmid-disk
qm move-disk $vmid $disk $datastore --delete qm move-disk $vmid $disk $datastore --delete
done done
done done
``` ```

View File

@@ -1,13 +1,18 @@
#!/bin/bash #!/bin/bash
# Get VMID from VM list: qm list
# Get all list of datastores: pvesm status
myvmid=$1 myvmid=$1
datastore=$2 datastore=$2
echo *** echo ***
echo Moving $myvmid to $datastore echo Moving $myvmid to $datastore
echo
for vmid in $myvmid; do for vmid in $myvmid; do
for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do
echo Moving: vm-$vmid-disk
qm move-disk $vmid $disk $datastore --delete qm move-disk $vmid $disk $datastore --delete
done done
done done