Skip to content

Instantly share code, notes, and snippets.

@mrl22
Last active July 24, 2025 05:12
Show Gist options
  • Select an option

  • Save mrl22/df6cfcaab00d61b2e09943241ef8590c to your computer and use it in GitHub Desktop.

Select an option

Save mrl22/df6cfcaab00d61b2e09943241ef8590c 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;
@revjamie
Copy link

This is amazing! Thank you! Anyway to run these in parallel? I have a lot of VMs and a 10 gig connection :)

@Duviri
Copy link

Duviri commented Jul 24, 2025

you saved me a bunch of clicks, thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment