[libvirt-users] how to mount /dev/shm on system container

i have create a system container test1 and trying to mount /dev/shm inside a container <domain type='lxc'> <name>test1</name> <memory>102400</memory> <os> <type>exe</type> <init>/sbin/init</init> </os> <vcpu>1</vcpu> <devices> <console type='pty'/> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount' accessmode='passthrough'> <source dir='/lxc/test1/'/> <target dir='/'/> </filesystem> <interface type='bridge'> <source bridge='br0'/> </interface> </devices> </domain> network settings on host /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="dhcp" BRIDGE="br0" HWADDR="08:00:27:97:D6:35" NM_CONTROLLED="no" ONBOOT="yes" TYPE="Ethernet" UUID="fe9d7236-f418-47ab-b472-6e6caabdd807" /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE="br0" TYPE="Bridge" USERCTL="no" ONBOOT="yes" BOOTPROTO="dhcp" NM_CONTROLLED="no" network setting on host /lxc/test1/etc/sysconfig/network-scripts/ifcfg-eth0 EVICE=eth0 ONBOOT=yes TYPE=Ethernet BOOTPROTO=dhcp PREFIX=24 USERCTL=yes IPV6INIT=no vim /lxc/test1/etc/fstab none /dev/shm tmpfs defaults 0 0 chroot /lxc/test1 mkdir -m 1777 /dev/shm After mounting /dev/shm on container, my container gets hang. Has anyone tried to mount /dev/shm ? Thanks, Aarti Sawant NTTDATA OSS Center Pune

On Tue, Sep 24, 2013 at 03:07:11PM +0530, Aarti Sawant wrote:
i have create a system container test1 and trying to mount /dev/shm inside a container
<domain type='lxc'> <name>test1</name> <memory>102400</memory> <os> <type>exe</type> <init>/sbin/init</init> </os> <vcpu>1</vcpu> <devices> <console type='pty'/> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount' accessmode='passthrough'> <source dir='/lxc/test1/'/> <target dir='/'/> </filesystem> <interface type='bridge'> <source bridge='br0'/> </interface> </devices> </domain>
You need to add a RAM filesystem http://libvirt.org/formatdomain.html#elementsFilesystems eg <filesystem type='ram'> <source usage='10000'/> <target dir='/dev/shm'/> </filesystem> usage is in KB Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Hello, thanks a lot it worked.. Thanks Aarti Sawant NTTDATA OSS Center Pune On Tue, Sep 24, 2013 at 3:44 PM, Daniel P. Berrange <berrange@redhat.com>wrote:
On Tue, Sep 24, 2013 at 03:07:11PM +0530, Aarti Sawant wrote:
i have create a system container test1 and trying to mount /dev/shm inside a container
<domain type='lxc'> <name>test1</name> <memory>102400</memory> <os> <type>exe</type> <init>/sbin/init</init> </os> <vcpu>1</vcpu> <devices> <console type='pty'/> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount' accessmode='passthrough'> <source dir='/lxc/test1/'/> <target dir='/'/> </filesystem> <interface type='bridge'> <source bridge='br0'/> </interface> </devices> </domain>
You need to add a RAM filesystem
http://libvirt.org/formatdomain.html#elementsFilesystems
eg
<filesystem type='ram'> <source usage='10000'/> <target dir='/dev/shm'/> </filesystem>
usage is in KB
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/:| |: http://libvirt.org -o- http://virt-manager.org:| |: http://autobuild.org -o- http://search.cpan.org/~danberr/:| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc:|
participants (2)
-
Aarti Sawant
-
Daniel P. Berrange