Is there a container equivalent for qm disk import?

pgcudahy

Member
Jan 14, 2023
9
0
6
I had an non-backed up proxmox server that died (I know, I've learned that lesson). I was able to mount the old drive in a recovery environment and use dd to recover the vm disks to a backup disk as well as /etc/pve for all my config. For my VMs, I could use a command like qm disk import 101 /mnt/backup/vm-101-disk-0 local-lvm to import the backup vm disk and get it up and running. However, I can't find a comparable procedure for getting the rootfs backup for a lxc container into local-lvm. In my prior configuration it had been set up as

rootfs: local-lvm:vm-102-disk-0,size=32G

How do I get my /mnt/backup/vm-102-disk-0 into local-lvm? I don't want to bind to my backup disk at /mnt/backup since I don't want to keep it always connected to my server.
 
Hmm, if the target is also on an LV, you could just go ahead and dd from source to target LV.

Overall, how a container volume is stored depends quite a bit more on the underlying storage. File based ones use a raw file, on ZFS it is a ZFS file system Dataset.
Sometimes a loop mount is needed (e.g. raw files) to be able to mount the file system inside in the namespace of the container.
 
I tried

Code:
pvesm alloc local-lvm 102 vm-102-disk-0 32G
dd if=/mnt/backup/vm-102-disk-0 of=/dev/pve/vm-102-disk-0 bs=8M status=progress
pct rescan

But the container won't boot. Any suggestions?