2024-02-15 09:33:32 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-02-15 09:37:01 -07:00
|
|
|
# to convert existing virtualbox VDI disks to qcow2, for import into proxmox vm environment
|
|
|
|
# 2024 kneutron
|
|
|
|
|
|
|
|
# xxx TODO EDITME - this is the base dir for virtualbox / disk images
|
2024-02-15 09:33:32 -07:00
|
|
|
based="/zseatera4-f4m8/virtbox-virtmachines"
|
|
|
|
cd "$based" || exit 44;
|
|
|
|
|
2024-02-15 09:37:01 -07:00
|
|
|
# xxx TODO EDITME - this is where converted disks .qcow2 will go
|
2024-02-15 09:33:32 -07:00
|
|
|
dest=/mnt/seatera4-xfs
|
|
|
|
|
|
|
|
for disk in $(find -name *.vdi |sed 's|^./||'); do
|
|
|
|
dirn=$(dirname "$disk")
|
|
|
|
cd "$based/$dirn"; echo "HERE is: $PWD"
|
|
|
|
|
|
|
|
diskn=$(basename "$disk")
|
|
|
|
|
2024-02-15 09:37:01 -07:00
|
|
|
#echo "dirn=$dirn"
|
|
|
|
#echo "disk=$disk"
|
|
|
|
#echo "diskn=$diskn"
|
2024-02-15 09:33:32 -07:00
|
|
|
|
2024-02-15 09:37:01 -07:00
|
|
|
echo "$(date) - Converting $PWD $diskn"
|
2024-02-15 09:33:32 -07:00
|
|
|
time qemu-img convert -f vdi -O qcow2 "$PWD/$diskn" "$dest/$diskn.qcow2"
|
|
|
|
# cd "$based"
|
|
|
|
done
|
|
|
|
|
|
|
|
ls -alh "$dest"
|
|
|
|
date
|