[lxc-users] lxc-create try rsync data to device instead mount point
mxs kolo
kolomaxes at gmail.com
Fri Jul 25 14:16:17 UTC 2014
On 7/25/14, mxs kolo <kolomaxes at gmail.com> wrote:
> Hi
>> The other templates only take rootfs from the config file if lxc-create
>> did not pass in "--rootfs". I think you should do the same, because
>> lxc should have already mounted the device for you.
> Where LXC placed mount directory ?
Yes, you right. LXC already mount /dev/mapper/* in directory
/usr/lib/lxc/rootfs/
And problem in lxc-centos and other template fixed with small patch:
# diff -uN /usr/share/lxc/templates/lxc-centos
/usr/share/lxc/templates/lxc-centos.ORIG
--- /usr/share/lxc/templates/lxc-centos 2014-07-25 17:52:11.509618392 +0400
+++ /usr/share/lxc/templates/lxc-centos.ORIG 2014-07-07
12:39:32.430333034 +0400
@@ -686,7 +686,7 @@
case "$1" in
-h|--help) usage $0 && exit 0;;
-p|--path) path=$2; shift 2;;
- --rootfs) rootfs_path=$2; shift 2;;
+ --rootfs) rootfs=$2; shift 2;;
-n|--name) name=$2; shift 2;;
-c|--clean) clean=$2; shift 2;;
-R|--release) release=$2; shift 2;;
It's all. :)
And one common mount point means that You can't simultaneously create
more then one LXC in time, right ?
p.s.
But LXC always mount /dev on directory /usr/lib/lxc/rootfs, even if pass
rootfs parameter:
# lxc-create -t centos -n t1 -B lvm --lvname=t1 --vgname=data
--fstype=xfs --fssize=10G -- --release 6 --rootfs=/mnt/1
File descriptor 3 (/var/lib/lxc/t1/partial) leaked on lvcreate
invocation. Parent PID 20287: lxc-create
WARNING: xfs signature detected on /dev/data/t1 at offset 0. Wipe it? [y/n] y
Wiping xfs signature on /dev/data/t1.
Logical volume "t1" created
Host CPE ID from /etc/os-release: cpe:/o:centos:centos:7
DBG ==>/mnt/1<==
/dev/mapper/data-t1 on /usr/lib/lxc/rootfs type xfs
(rw,relatime,attr2,inode64,sunit=1024,swidth=2048,noquota)
Checking cache download in /var/cache/lxc/centos/x86_64/6/rootfs ...
Cache found. Updating...
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.yandex.ru
* extras: mirror.yandex.ru
* updates: mirror.yandex.ru
base
| 3.7 kB 00:00
extras
| 3.4 kB 00:00
updates
| 3.4 kB 00:00
Setting up Update Process
No Packages marked for Update
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
0 package files removed
Update finished
Copy /var/cache/lxc/centos/x86_64/6/rootfs to /mnt/1 ...
Copying rootfs to /mnt/1 ...
And container is broken:
# grep lxc.rootfs /var/lib/lxc/t1/config
lxc.rootfs = /dev/data/t1
But /dev/data/t1 is empty and all files placed in /mnt/1 directory.
b.r.
Maxim Kozin
More information about the lxc-users
mailing list