Installing Volumio in Proxmox (installing a .img in Proxmox)

Proxmox is a fabulous hypervisor (or more properly, a fabulous management suite for the KVM hypervisor) but its storage model is a little strange. It works great unless you need to do something a little odd, and then it gets difficult to deal with. I wanted to install Volumio audio player as a centralized audio server in Proxmox, so I could use Snapcast to create a whole-house audio system. Volumio has a prebuilt x86 disk image (a .img file) but Proxmox makes it very difficult to use that as a hard disk.

The Solution:

After attempting many other possible solutions, I discovered it would be next to impossible to do the classic trick of converting the .img to a .qcow2 hard disk thanks to the weirdness associated with KVM disks on a ZFS filesystem. Here is what I came up with:

  1. Create a new VM with two hard disks.
  2. Load an Ubuntu ISO in the disk drive (or something else, any live CD will work)
  3. Create a single EXT4 partition spanning the entire first hard disk, and mount it on your live system.
  4. sudo apt install openssh-server so you have SSH access to your system. You may have to use passwd to set a password for the live user.
  5. From the PC you've downloaded the .img on, open an SFTP client (FileZilla will work) and visit sftp://xubuntu@your-vm-ip:22 to get access to the VM filesystem.
  6. Copy the .img file to your EXT4 virtual hard drive mount.
  7. Now you have easy access to the .img, and you have an unused, blank hard drive connected to the VM (the second virtual drive). So use dd if=/path/to/my/image.img of=/dev/sdx status=progress to write the image file to your hard disk.
  8. Delete the first hard disk, remove the live CD, and reboot the VM. Enjoy your newly imaged hard disk!