-
This commit is contained in:
27
Proxmox/move vm to new datastore.md
Normal file
27
Proxmox/move vm to new datastore.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Move VM to new datastore
|
||||||
|
|
||||||
|
Note: Make sure there is enough free space on the destination datastore.
|
||||||
|
|
||||||
|
## Move using the GUI
|
||||||
|
|
||||||
|
Find the VM you want to move, then go to the Hardware tab. Mark each drive and under `Disk Action` select `Move Storage`. Follow the
|
||||||
|
|
||||||
|
## Move using the CLI
|
||||||
|
|
||||||
|
### Example bash script:
|
||||||
|
```
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
myvmid=$1
|
||||||
|
datastore=$2
|
||||||
|
|
||||||
|
echo ***
|
||||||
|
echo Moving $myvmid to $datastore
|
||||||
|
|
||||||
|
for vmid in $myvmid; do
|
||||||
|
for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do
|
||||||
|
qm move-disk $vmid $disk $datastore --delete
|
||||||
|
done
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
13
Proxmox/moveVmToNewDatastore.sh
Normal file
13
Proxmox/moveVmToNewDatastore.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
myvmid=$1
|
||||||
|
datastore=$2
|
||||||
|
|
||||||
|
echo ***
|
||||||
|
echo Moving $myvmid to $datastore
|
||||||
|
|
||||||
|
for vmid in $myvmid; do
|
||||||
|
for disk in $(qm config $vmid | grep vm-$vmid-disk | cut -d: -f1); do
|
||||||
|
qm move-disk $vmid $disk $datastore --delete
|
||||||
|
done
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user