Mounting LXC raw images

apmuthu

Renowned Member
Feb 26, 2009
871
12
83
Chennai - India & Singapore
github.com
One thread stated that LXC containers do not have a mounted state.

Here is how we can mount a stopped LXC container (CTID = 102 here):
Code:
# pct mount 102
mounted CT 102 in '/var/lib/lxc/102/rootfs'

# ls -al /var/lib/lxc/102/rootfs
total 96
drwxr-xr-x 21 100000 100000  4096 Sep 19 23:14 .
drwxr-xr-x  3 root   root    4096 Sep 19 23:16 ..
drwxr-xr-x  2 100000 100000  4096 Sep 16 10:12 bin
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 boot
drwxr-xr-x  2 100000 100000  4096 Dec 10  2008 dev
drwxr-xr-x 60 100000 100000  4096 Sep 19 23:14 etc
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 home
drwxr-xr-x  8 100000 100000  4096 Sep 16 10:12 lib
drwx------  2 root   root   16384 Sep 19 23:08 lost+found
drwxr-xr-x  2 100000 100000  4096 Sep 16 10:08 media
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 mnt
drwxr-xr-x  2 100000 100000  4096 Sep 16 10:08 opt
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 proc
drwx------  2 100000 100000  4096 Sep 16 11:31 root
drwxr-xr-x  2 100000 100000  4096 Sep 16 10:13 sbin
drwxr-xr-x  2 100000 100000  4096 Jul 21  2010 selinux
drwxr-xr-x  2 100000 100000  4096 Sep 16 10:08 srv
drwxr-xr-x  2 100000 100000  4096 Mar 28  2012 sys
drwxrwxrwt  2 100000 100000  4096 Sep 19 23:15 tmp
drwxr-xr-x 10 100000 100000  4096 Sep 16 10:08 usr
drwxr-xr-x 14 100000 100000  4096 Sep 16 10:12 var

# pct unmount 102
 
Hi,
that post is 7 years old. Of course things might've changed in the meantime ;)