Saving files from an qcow2 image of an ext4 partition

sail3006

New Member
Nov 29, 2024
1
0
1
Hi I am new to proxmox and Linux in generall...
I have an Openmediavault VM and i used to have an ext4 formated HDD drive. Before i switched to ZFS i saved the qcow2 image of this partition. Now that i have formated the HDD to the ZFS file system i need to retriev the data from the old EXT4 partition.
How can i do that? is there a way to mount the qcow2 file as a virtual hard drive to proxmox?
 
Welcome to Proxmox Community Forum :)

You can mount a qcow2 directly on a path:

  • loading the kernel module: modprobe nbd
  • connect FILE to the local NBD device DEV: qemu-nbd -c /dev/nbd0 <path to your qcow2>
  • mount the qcow2 to a path you would like: mount /dev/nbd0p2 <mountpoint>
  • Do your things...
  • Unmount: umount /mnt/tmp
  • Disconnect the device: qemu-nbd -d /dev/nbd0
You can also import a qcow2 directly:
Code:
qm importdisk <vmid> filename.qcow2 <storage name>

See also qm help importdisk