dialup4eg
(Dmitry)
February 13, 2024, 2:46pm
1
I have containers that have been created in LVM. Each container has its own LVM.
/dev/vg0/one
/dev/vg0/two
/dev/vg0/tрree
In incus I added lvm thin storage. When importing I specify -storage lvm-thin-storage. To move the data to the new storage. The export happens without errors, but when I run the imported container I see
Error: Unable to resolve container rootfs: lstat /var/lib/incus/storage-pools/lvm-thin-storage/containers/name/rootfs: no such file or directory
How can I fix this?
stgraber
(Stéphane Graber)
February 13, 2024, 2:59pm
2
Hmm, I don’t think lxc-to-incus
knows what to do with LVM unfortunately.
I think your best bet is to delete the Incus containers you created, then manually mount your LVs on the corresponding /var/lib/lxc/NAME/rootfs and attempt lxc-to-incus
again. That time it should actually get the data and move it over.
dialup4eg
(Dmitry)
February 13, 2024, 3:57pm
3
lxc-to-incus --containers backup --storage lvm-thin-pool --debug
Parsing LXC configuration
Container configuration:
lxc.rootfs.path = lvm:/dev/vg0/backup
lxc.uts.name = backup
lxc.arch = amd64
lxc.net.0.type = veth
lxc.net.0.link = br0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:dd:92:96
lxc.start.auto = 1
lxc.apparmor.profile = unconfined
lxc.cgroup.devices.allow = a
Checking for unsupported LXC configuration keys
Checking for existing containers
Checking whether container has already been migrated
Validating whether incomplete AppArmor support is enabled
Validating whether mounting a minimal /dev is enabled
Validating container rootfs
Processing network configuration
Processing storage configuration
Processing environment configuration
Processing container boot configuration
Processing container apparmor configuration
Processing container seccomp configuration
Processing container SELinux configuration
Processing container capabilities configuration
Processing container architecture configuration
Container config:
{
"architecture": "x86_64",
"config": {
"boot.autostart": "true",
"raw.lxc": "lxc.apparmor.profile=unconfined\n",
"security.privileged": "true"
},
"devices": {
"eth0": {
"type": "none"
},
"net0": {
"hwaddr": "00:16:3e:dd:92:96",
"nictype": "bridged",
"parent": "br0",
"type": "nic"
},
"root": {
"path": "/",
"pool": "lvm-thin-pool",
"type": "disk"
}
},
"ephemeral": false,
"profiles": [
"default"
],
"stateful": false,
"description": "",
"name": "backup",
"source": {
"type": "migration",
"certificate": "",
"mode": "push",
"allow_inconsistent": false
},
"instance_type": "",
"type": "",
"start": false
}
Creating container
Container 'backup' successfully created
But,
Error: Unable to resolve container rootfs: lstat /var/lib/incus/storage-pools/lvm-thin-pool/containers/backup/rootfs: no such file or directory
stgraber
(Stéphane Graber)
February 13, 2024, 5:11pm
4
Ah, right, so I think you actually need two things:
Mount /dev/vg0/backup to /var/lib/lxc/backup/rootfs
Change lxc.rootfs.path
to /var/lib/lxc/backup/rootfs
Then run lxc-to-incus
and it should actually transfer the data this time around.
dialup4eg
(Dmitry)
February 13, 2024, 5:51pm
5
Thank you. Best! I didn’t realize to fix config where lvm is specified.