Converting a raw disk to qcow2

obsolete

New Member
Mar 23, 2021
21
2
3
55
Hello,

I am trying to figure out how to convert the VM disk for one of my VMs from raw to qcow2 so I can enable snapshots.

First, I need to figure out the path of the VM disk, so I issue the following:
Bash:
root@pve11:~# pvesm list vmpool11 --vmid 124
Volid                  Format  Type             Size VMID
vmpool11:vm-124-disk-0 raw     images    48318382080 124

With the VolID, I try to find the vm path:
Bash:
root@pve11:~# pvesm path vmpool11:vm-124-disk-0
/dev/vmpool11/vm-124-disk-0

Cool, so, now I try to enumerate the directory...
Bash:
root@pve11:~# ls -la /dev/vmpool/vm-124-disk-0
ls: cannot access '/dev/vmpool/vm-124-disk-0': No such file or directory

Huh. Weird. Let's just try enumerating /dev/vmpool11/ and see what we get...
Bash:
...
lrwxrwxrwx  1 root root           8 Oct 13 13:44 vm-120-disk-0 -> ../dm-37
lrwxrwxrwx  1 root root           8 Oct 16 01:00 vm-121-disk-0 -> ../dm-40
lrwxrwxrwx  1 root root           8 Oct 17 22:48 vm-122-disk-0 -> ../dm-42
lrwxrwxrwx  1 root root           8 Oct 16 01:06 vm-123-disk-0 -> ../dm-43
lrwxrwxrwx  1 root root           8 Oct 25 11:23 vm-125-disk-0 -> ../dm-46
lrwxrwxrwx  1 root root           8 Oct 25 11:23 vm-125-disk-1 -> ../dm-47
...

wut? It's not there... I don't see any trace of VM 124...

vmpool11 is a LVM VG... so let's check lvdisplay and see what comes back:
Bash:
root@pve11:~# lvdisplay /dev/vmpool11
...
  --- Logical volume ---
  LV Path                /dev/vmpool11/snap_vm-127-disk-1_clean
  LV Name                snap_vm-127-disk-1_clean
  VG Name                vmpool11
  LV UUID                gJiWW0-s9dk-NVaP-e81R-7Ydb-CGKW-WrRuH9
  LV Write Access        read only
  LV Creation host, time pve11, 2021-10-26 17:40:38 -0400
  LV Pool name           vm-thinpool
  LV Thin origin name    vm-127-disk-1
  LV Status              NOT available
  LV Size                4.00 MiB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
...

Huh. Are VM disks created as volume groups or something? Let's experiment..
Bash:
root@pve11:~# lvdisplay /dev/vmpool11/vm-124-disk-0
  --- Logical volume ---
  LV Path                /dev/vmpool11/vm-124-disk-0
  LV Name                vm-124-disk-0
  VG Name                vmpool11
  LV UUID                lH9B4l-Azxq-WJTc-1d6c-d5OS-e7XH-h53qpm
  LV Write Access        read/write
  LV Creation host, time pve11, 2021-10-16 01:07:38 -0400
  LV Status              NOT available
  LV Size                45.00 GiB
  Current LE             11520
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

I wasn't really expecting that to work...

Ok... let's try something a but more rudimentary... How about just a standard find?
Bash:
root@pve11:~# find / -name vm-124-disk-0
root@pve11:~# find / -name vm-125-disk-0
/dev/vmpool11/vm-125-disk-0
...

Nope. Nothing. So, now I'm out of things that I know to try... How do I convert the VM disk for that VM? qemu-img convert doesn't work if I point it to what is supposedly the VM disk path...
 
Last edited:
root@pve11:~# lvdisplay /dev/vmpool11/vm-124-disk-0 --- Logical volume --- LV Path /dev/vmpool11/vm-124-disk-0 LV Name vm-124-disk-0 VG Name vmpool11 LV UUID lH9B4l-Azxq-WJTc-1d6c-d5OS-e7XH-h53qpm LV Write Access read/write LV Creation host, time pve11, 2021-10-16 01:07:38 -0400 LV Status NOT available LV Size 45.00 GiB Current LE 11520 Segments 1 Allocation inherit Read ahead sectors auto


the status is `not available` ,you should focus this