Anatomy of LXC Container Config File: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(Created page with "== Location == For PVE Node: '''pr64''' and CT '''101''' the location is at <tt>/etc/pve/nodes/pr64/lxc/101.conf</tt> This configuration gets copied over '''on startup''' of...")
 
Line 5: Line 5:


== Mounting the <tt>rootfs</tt> ==
== Mounting the <tt>rootfs</tt> ==
* [https://forum.proxmox.com/threads/mount-host-directory-into-lxc-container.66555/post-299027 Mounting into a container]
* [https://tweenpath.net/proxmox-change-local-lvm-local-storage/ local-lvm to local storage]
 
=== 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 ==
* [https://github.com/bashclub/zamba-lxc-toolbox Zamba LXC Toolbox]
* [https://forum.proxmox.com/threads/mount-host-directory-into-lxc-container.66555/post-299027 Mounting into a container] - [https://www.jamescoyle.net/how-to/2019-proxmox-4-x-bind-mount-mount-storage-in-an-lxc-container bind mount for LXC] - will not remove the mount point and that has to be done manually.
* [https://forum.proxmox.com/threads/does-proxmox-support-lxc-dir-backend.98486/post-425822 LXC on flat File System]
* [https://www.diytechguru.com/2020/12/12/proxmox-lvm-directory/ DIY Add Disks]
* [https://forum.proxmox.com/threads/how-to-mount-existing-disk-to-storage.66559/ Mount existing Storage]
 
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

Revision as of 14:56, 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