putting VM/LXC root disks on NAS

proxwolfe

Well-Known Member
Jun 20, 2020
534
64
48
50
Hi,

I understand that I can have a VM's root disk on a NAS but not an LXC's.

Why is that, is that absolute or might there be a way to also put an LXC's root disk on a NAS after all and, if not, are there plans to make this possible in the future?

I run everything I can in an LXC and only those guests that don't like that in a VM. So putting the VMs' root disks on a NAS but not the LXCs' doesn't help me. It's all or nothing.

Thanks
 
why should you not be able to put an lxc rootfs on a nas? you can put container volumes on any storage that supports the content type 'rootdir', check the docs which storage types support that
 
Sorry, I wasn’t clear: I have put an lxc‘s root disk on my NAS. So, you are right that I „can“.

The container just doesn‘t start. So being able to do it, is of limited use…

When trying to resolve the issue, I came across some other forum posts with similar starting problems where they were told that you can only have a VM‘s root disk on a NAS but not an lxc‘s. (I can later google that issue again to find the threads.)
 
Hello, I am having the same issue. It creates the lxc root disk on the NAS but then will not start it and says it does not exist. This is my logs from running the debug code above.

Code:
root@pve1:~# pct start 101 --debug
run_buffer: 571 Script exited with status 255
lxc_init: 845 Failed to run lxc.hook.pre-start for container "101"
__lxc_start: 2034 Failed to initialize container "101"
0 hostid 100000 range 65536
INFO     lsm - ../src/lxc/lsm/lsm.c:lsm_init_static:38 - Initialized LSM security driver AppArmor
INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "101", config section "lxc"
DEBUG    utils - ../src/lxc/utils.c:run_buffer:560 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 101 lxc pre-start produced output: mount: /var/lib/lxc/.pve-staged-mounts/rootfs: can't read superblock on /dev/loop0.
dmesg(1) may have more information after failed mount system call.

DEBUG    utils - ../src/lxc/utils.c:run_buffer:560 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 101 lxc pre-start produced output: command 'mount /dev/loop0 /var/lib/lxc/.pve-staged-mounts/rootfs' failed: exit code 32

ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 255
ERROR    start - ../src/lxc/start.c:lxc_init:845 - Failed to run lxc.hook.pre-start for container "101"
ERROR    start - ../src/lxc/start.c:__lxc_start:2034 - Failed to initialize container "101"
INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "101", config section "lxc"
startup for container '101' failed
 
VM's work just fine installed on NAS but not containers. This is how I think I know it is not network or permission related. Any help would be greatly appreciated.
 
As the lxc is down anyway migrate the lxc101 disk to any type of local storage in your pve node.
Does it start then (I assume even then not and you have to create it new again) ?
 
yes it gives me this error.

Code:
mount: /var/lib/lxc/102/.copy-volume-2: cannot mount /dev/loop0 read-only.
       dmesg(1) may have more information after failed mount system call.
Specified filename /var/lib/lxc/102/.copy-volume-1 does not exist.
TASK ERROR: command 'mount -o ro /dev/loop0 /var/lib/lxc/102/.copy-volume-2//' failed: exit code 32
 
This might be from old containers with the same ID. I did not name them that. I have just tried a new container with an ID I have never used and am still getting the same issue.