Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to access the container's rootfs from the host. While I could just use the directory that was passed to lxc.rootfs, it doesn't have the mounts that the container has, so there are just empty directories instead of the mounts. Is there a way to get the same file tree as the container root?

Thanks :)

share|improve this question
up vote 0 down vote accepted

The best solution I was able to find is to apply the same mounts both on the host and inside the container (via lxc.mount[.entry]). Mounts from the host do not transfer to the container as the container is fully isolated from the host's mounts.

share|improve this answer

I use the following method for backup using rsync:

Using the pid of the container's init process, you can get it using

# list all hosts:
lxc-ls -f -Fname,pid

# or get pid of one host:
lxc-ls -f -Fpid mycontainer
PID    
-----
13323

Using this information, you can access the host's rootfs using the /proc filesystem.

cat /proc/13323/root/etc/hostname
# returns: "mycontainer"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.