LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 02-14-2017, 12:37 PM   #1
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
LXC rootfs


I just started working with Proxmox. We have several LXC containers. All are working fine but I want to view the contents of the container root directory. Seems to make sense to me since LXC containers are advertised as chroot on steriods. I thought /var/lib/lxc/{container}/rootfs is supposed to be that portal but all I see is an empty directory.

Am I correct that I should be able to view the container root directory in this manner?

Thanks.
 
Old 02-16-2017, 02:44 PM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
I want to view the contents of the container root directory
Log into the guest node and type " cd / && ls -al"
Quote:
I /var/lib/lxc/{container} /rootfs
The rootfs location is wherever you designated it was when you booted the container, often it's a remote drive mounted in /etc /fstab (makes storage management significantly simpler if leverage a modern SAN/NAS here)
That said, it could be as simple as a permissions issue. You may have root access on the guest but to find the guest on the hosts file system, you'd (probably) need root access on the host. An easy test is to save a uniquely named file system handle on the guests root directory and then do a "find" for it on the host.
If you can't "find" it, it's probably a permissions issue.
 
Old 02-18-2017, 11:51 AM   #3
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Original Poster
Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
Log into the guest node and type " cd / && ls -al"
Yes, that works fine, but not what I intended. I did not fully explain. I want to view the root directory of the LXC containers from within the host. That is, LXC containers are loosely advertised as a "chroot on steroids." If that is the case then I should be able to view the contents of the LXC container root directory from within the host. I thought the rootfs directory was that portal.

I do not think this is a permissions issue. For example, a container config file contains the following:

lxc.rootfs = /var/lib/lxc/201/rootfs

Where 201 is the container ID.

Looking in /var/lib/lxc/201/rootfs shows an empty directory.
 
Old 03-26-2017, 06:49 PM   #4
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Original Poster
Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
I found a way to use /var/lib/lxc/${container}/rootfs.

In Proxmox, LXC conf files are installed at /etc/pve/local/lxc/${container}.conf.

* Find the device path of each LXC. For example, /dev/pve/vm-${container}-disk-1.
* Mount the device path /dev/pve/vm-${container}-disk-1 to /var/lib/lxc/${container}/rootfs.

That's all.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LXC + Slackware 14.1 (understanding) Hyakutake Slackware 7 11-05-2014 05:42 AM
LXC in Diskless Client sunveer Linux - Software 2 09-29-2014 03:34 AM
Rootfs twice techux Linux - General 8 07-10-2013 07:40 PM
slackware lxc / iptables ccie15672 Linux - Virtualization and Cloud 0 02-26-2012 06:58 PM
Using an ISO image as rootfs for a LXC alphy Linux - Virtualization and Cloud 0 07-22-2011 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration