Jasmin shahrzad
asked on
installation lxd containers
how to install lxd container in non default directories on ubuntu 18.0.3 server?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Maybe describe what you're trying to achieve or some problem you're trying to resolve.
LXD != LXC, so changing directories may cause privilege problems.
With LXC (lxc-create) all containers run as privileged (root) containers.
LXD changes this so all containers run as unprivileged (non-root) containers.
If you try doing this, be sure you do the following.
#
If you muck about with LXD data structures outside LXD, then you'll first have to decode /var/snap/lxd/common/lxd/d atabase/lo cal.db + every time you much about with LXD outside LXD, you'll have to determine how to hack local.db to match your changes.
Tip: Unless you have lots of time on your hands, you'll prefer doing LXD things... the LXD way...
With LXC you could just move things around however you like. LXD will tends to crash if you do anything like LXC allowed.
LXD != LXC, so changing directories may cause privilege problems.
With LXC (lxc-create) all containers run as privileged (root) containers.
LXD changes this so all containers run as unprivileged (non-root) containers.
If you try doing this, be sure you do the following.
#
First remove all APT LXD packages as these are all out of date + will never be updated again
apt-get -y purge liblxc-common liblxc1 lxcfs lxd lxd-client
# Now install SNAP LXD, which is upgraded automagically whenever patches release
snap install lxd
# Now run lxd init to set your alternative storage device (do not muck about with this outside LXD)
lxd init --storage-backend=type --storage-create-device=some-alternative-device
If you muck about with LXD data structures outside LXD, then you'll first have to decode /var/snap/lxd/common/lxd/d
Tip: Unless you have lots of time on your hands, you'll prefer doing LXD things... the LXD way...
With LXC you could just move things around however you like. LXD will tends to crash if you do anything like LXC allowed.
Open a https://discuss.linuxconta iners.org discussion thread about any LXD hacking + one of the developers will let you know if what you're trying to do will work as you expect.
ASKER
@noci,
first i do not have anything under my /var/lib/lxc.. this directory is empty.
what i want to do is i mount a 6tb disk and in my ubuntu and move one of containers (or create a new ubuntu 18 container) with 3tb disk .
when i search after my container name (find . -depth -name "my-container*") i can see memory , cpu ,.. place also storage place
/var/lib/lxcfs/cgroup/cpu, cpuacct/lx c.payload/
/var/lib/lxcfs/cgroup/memo ry/lxc.pay load/
/var/snap/lxd/common/lxd/s torage-poo ls/default /container s/
but this storage i also empty
all my containers has default size all says (for df -h ) :
default/containers/"contai ner_name 79G(size) 710M(Used) 78G(Avail) ...
where i and (when ) under create define disk place? and how to change it?
first i do not have anything under my /var/lib/lxc.. this directory is empty.
what i want to do is i mount a 6tb disk and in my ubuntu and move one of containers (or create a new ubuntu 18 container) with 3tb disk .
when i search after my container name (find . -depth -name "my-container*") i can see memory , cpu ,.. place also storage place
/var/lib/lxcfs/cgroup/cpu,
/var/lib/lxcfs/cgroup/memo
/var/snap/lxd/common/lxd/s
but this storage i also empty
all my containers has default size all says (for df -h ) :
default/containers/"contai
where i and (when ) under create define disk place? and how to change it?
To add to be above suggestion: if you already have containers running then stop your containers and LXD, then move your containers to the new location, create the symlink and start everything again.