Skip to content

Instantly share code, notes, and snippets.

@linuxmail
Forked from mrl22/move-storage.sh
Created August 24, 2021 12:53
Show Gist options
  • Save linuxmail/07dc4d8abc4c2fe63ee879fbf6cb11f2 to your computer and use it in GitHub Desktop.
Save linuxmail/07dc4d8abc4c2fe63ee879fbf6cb11f2 to your computer and use it in GitHub Desktop.
Bash script to move storage of all Proxmox Virtual Machines to different storage
#!/bin/sh
movefrom='micronssd'
moveto='wdredpro'
for vm in $(qm list | awk '{print $1}' | grep -Eo '[0-9]{1,3}');
do
for storage in $(qm config $vm | grep $movefrom: | awk '{print $1}' | grep -Eo '[a-z0-9]+');
do
echo Moving VM$vm Storage $storage
qm move_disk $vm $storage $moveto --delete
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment