Import logical volume to ceph storage

unam

Active Member
Nov 21, 2019
24
3
43
37
Hi,
I just started a lab with 3 hypervisors :
- 2x Intel Xeon
- 256Gb ram
- 4x960Gb SSD Intel
- 4x4To WD

I just configured a ceph storage with crush replication rules for ssd and hdd.
A the moment, I just configured two nodes, the latest is in production, using Debian and libvirt to provide lxc and kvm created and managed with libvirtd.

My question is : how can I import lxc containers and kvm from libvirt to proxmox. Anyway I can recreate vms and containers in the new cluster but I did not find how to import and attach storage.

I already tried to import storage via ssh such as :

Code:
dd if=/dev/vg1/vm-xy | pv | ssh root@hypervisor01 'rbd --image-format 2 import - ceph_pool_ssd/vm-999-disk-0'

This is working and I can see the img in proxmox file manager and using rbd cli on the host.

I create a container, delete created storage, mv imported disk to new name and try to start
Code:
rbd -p ceph_pool_ssd rm vm-100-disk-0
rbd -p ceph_pool_ssd mv vm-999-disk-0 vm-100-disk-0
lxc-start -n 100 --logfile /tmp/100 -l  --logpriority DEBUG

Here is the output :

Code:
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:789 - Processing "keyctl errno 38"
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:975 - Added native rule for arch 0 for keyctl action 327718(errno)
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:984 - Added compat rule for arch 1073741827 for keyctl action 327718(errno)
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:994 - Added compat rule for arch 1073741886 for keyctl action 327718(errno)
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:1004 - Added native rule for arch -1073741762 for keyctl action 327718(errno)
lxc-start 100 20191121090851.715 INFO     seccomp - seccomp.c:parse_config_v2:1008 - Merging compat seccomp contexts into main context
lxc-start 100 20191121090851.715 INFO     conf - conf.c:run_script_argv:372 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "100", config section "lxc"
lxc-start 100 20191121090852.103 DEBUG    conf - conf.c:run_buffer:340 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 100 lxc pre-start produced output: mount: /var/lib/lxc/100/rootfs: wrong fs type, bad option, bad superblock on /dev/rbd0, missing codepage or helper program, or other error.

lxc-start 100 20191121090852.103 DEBUG    conf - conf.c:run_buffer:340 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 100 lxc pre-start produced output: command 'mount /dev/rbd0 /var/lib/lxc/100/rootfs//' failed: exit code 32

lxc-start 100 20191121090852.113 ERROR    conf - conf.c:run_buffer:352 - Script exited with status 32
lxc-start 100 20191121090852.113 ERROR    start - start.c:lxc_init:897 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20191121090852.113 ERROR    start - start.c:__lxc_start:2032 - Failed to initialize container "100"
lxc-start 100 20191121090852.113 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:862 - First child 539882 exited
lxc-start 100 20191121090852.113 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:865 - No such file or directory - Failed to receive the container state
lxc-start 100 20191121090852.114 ERROR    lxc_start - tools/lxc_start.c:main:329 - The container failed to start
lxc-start 100 20191121090852.114 ERROR    lxc_start - tools/lxc_start.c:main:332 - To get more details, run the container in foreground mode
lxc-start 100 20191121090852.114 ERROR    lxc_start - tools/lxc_start.c:main:335 - Additional information can be obtained by setting the --logfile and --logpriority options

I tried a fsck on the volume without success

Code:
root@rpk-hv01:~# pct fsck 100
fsck from util-linux 2.33.1
fsck.ext2: Unable to resolve 'rbd:ceph_pool_ssd/vm-100-disk-0:conf=/etc/pve/ceph.conf:id=admin:keyring=/etc/pve/priv/ceph/ceph_pool_ssd.keyring'
command 'fsck -a -l 'rbd:ceph_pool_ssd/vm-100-disk-0:conf=/etc/pve/ceph.conf:id=admin:keyring=/etc/pve/priv/ceph/ceph_pool_ssd.keyring'' failed: exit code 8

Any help is welcome !

Regards,
 
Thanks for your answer, I already checked this page but I did not find a solution.

I was reading again in the morning and find a kind of solution :

- On my libvirt host :
Code:
qemu-img convert -O qcow2 /dev/VG00/vm-XYZ ./vm-XYZ.qcow2
scp ./vm-XYZ.qcow2 root@mynewhost

- On my new proxmox host
Code:
qm create 110 --name vm-XYZ --bootdisk virtio0
qm importdisk 110 ./vm-XYZ.qcow2 my_ceph_pool
qm set --virtio0 my_ceph_pool:vm-110-disk-0

Tested with success on two vm. I'll check for lxc containers.

Thanks for reply.

Regards,
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!