Difference between revisions of "Anatomy of LXC Container Config File"

From Proxmox VE
Jump to navigation Jump to search
Line 12: Line 12:
  
 
  ls -al /var/lib/lxc/101/rootfs
 
  ls -al /var/lib/lxc/101/rootfs
 +
 +
<source>
 
total 96
 
total 96
 
drwxr-xr-x 21 100000 100000  4096 Sep 28 22:27 .
 
drwxr-xr-x 21 100000 100000  4096 Sep 28 22:27 .
Line 34: Line 36:
 
drwxr-xr-x 10 100000 100000  4096 Sep 28 22:04 usr
 
drwxr-xr-x 10 100000 100000  4096 Sep 28 22:04 usr
 
drwxr-xr-x 14 100000 100000  4096 Sep 28 22:05 var
 
drwxr-xr-x 14 100000 100000  4096 Sep 28 22:05 var
 +
</source>
  
 
  pct unmount 101
 
  pct unmount 101
Line 42: Line 45:
 
Copy a file from the container to the local system.
 
Copy a file from the container to the local system.
 
  pct pull <vmid> <path> <destination> [OPTIONS]
 
  pct pull <vmid> <path> <destination> [OPTIONS]
 
  
 
== Other Mount Info ==
 
== Other Mount Info ==

Revision as of 14:57, 29 September 2022

Location

For PVE Node: pr64 and CT 101 the location is at /etc/pve/nodes/pr64/lxc/101.conf

This configuration gets copied over on startup of the container to /etc/pve/lxc/101.conf

Mounting the rootfs

Anatomy

pct mount 101

mounted CT 101 in '/var/lib/lxc/101/rootfs'

ls -al /var/lib/lxc/101/rootfs
total 96
drwxr-xr-x 21 100000 100000  4096 Sep 28 22:27 .
drwxr-xr-x  3 root   root    4096 Sep 28 23:32 ..
drwxr-xr-x  2 100000 100000  4096 Sep 28 22:05 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 61 100000 100000  4096 Sep 28 22:27 etc
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 home
drwxr-xr-x  8 100000 100000  4096 Sep 28 22:05 lib
drwx------  2 root   root   16384 Sep 28 22:27 lost+found
drwxr-xr-x  2 100000 100000  4096 Sep 28 22:04 media
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 mnt
drwxr-xr-x  2 100000 100000  4096 Sep 28 22:04 opt
drwxr-xr-x  2 100000 100000  4096 Jul 14  2014 proc
drwx------  2 100000 100000  4096 Sep 28 22:31 root
drwxr-xr-x  2 100000 100000  4096 Sep 28 22:06 sbin
drwxr-xr-x  2 100000 100000  4096 Jul 21  2010 selinux
drwxr-xr-x  2 100000 100000  4096 Sep 28 22:04 srv
drwxr-xr-x  2 100000 100000  4096 Mar 28  2012 sys
drwxrwxrwt  4 100000 100000  4096 Sep 28 23:09 tmp
drwxr-xr-x 10 100000 100000  4096 Sep 28 22:04 usr
drwxr-xr-x 14 100000 100000  4096 Sep 28 22:05 var
pct unmount 101

Copy a local file to the container.

pct push <vmid> <file> <destination> [OPTIONS]

Copy a file from the container to the local system.

pct pull <vmid> <path> <destination> [OPTIONS]

Other Mount Info

mkdir /mnt/bak
mount /dev/sddX /mnt/bak

(this is only persistent until the next reboot)

You should then be able to browse the files of that storage in /mnt/bak

Configure storage in PVE GUI or use the CLI:

pvesm add dir bak --path /mnt/bak --content backup