User Tools

Site Tools


lxc

LXC in Proxmox

/usr/share/perl5/PVE/LXC/Setup

Restore unmanaged LXC container

working with any linux distro
cmode shell (no login)

pct restore 100 vzdump-openvz-100-xxx.tar.gz -storage=local-lvm -ostype=unmanaged -cmode shell

Mount LXC container for maintenance

pct mount CTID

to mount a container's volumes to /var/lib/lxc/CTID/rootfs/

Share DELL Compact Flash

/etc/pve/lxc/xxx.conf

mp0: /mnt/cflash,mp=/mnt

Transfer files to LXC

“pct pull” and “pct push” to transfer files from and to running containers
“pct exec” and “pct enter” to run individual commands or to spawn a shell inside a running container

Service cannot start

Systemd related - remove this line

PrivateTmp=true

Background services from command line terminated after start (rc.local for example)

options disable /dev/console

Low security better IO

pct restore CTID backup.tar.gz --rootfs local:0

This is identical to “simfs” in OpenVZ but unsecured.

/dev/X /c ext4    defaults,noatime,nodiratime,nobh,commit=40,barrier=0,data=writeback 0 2

/usr/share/perl5/PVE/LXC.pm

Turn off ACL
/var/lib/lxc/100/config

lxc.rootfs.options = noatime

Move LXC from loopback to filesystem

sudo vzdump 100 -compress lzo -dumpdir /var/lib/vz/dump -mode snapshot -remove 0
sudo pct restore 100 /var/lib/vz/dump/vzdump-lxc-101-xxx.tar.lzo --rootfs local:0

LXC Container information

lxc-info -n ID
Name:           105
State:          RUNNING
PID:            2744
IP:             10.160.149.27
CPU use:        291440.41 seconds
Memory use:     5.01 GiB
KMem use:       0 bytes
Link:           veth105i0
 TX bytes:      179.15 GiB
 RX bytes:      109.61 GiB
 Total bytes:   288.76 GiB
lxc.txt · Last modified: 2016/09/21 16:11 by Jan Forman