[lxc-devel] [PATCH] oracle template: mount /dev/shm as tmpfs

Serge Hallyn serge.hallyn at ubuntu.com
Tue May 21 21:47:17 UTC 2013


Quoting Dwight Engen (dwight.engen at oracle.com):
> sem_open(3) checks that /dev/shm is SHMFS_SUPER_MAGIC. Normally /dev/shm
> is mounted in the initramfs created by dracut, but that won't be run for
> a container so make sure that rc.sysinit mounts /dev/shm.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  templates/lxc-oracle.in | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
> index 946956d..70ef632 100644
> --- a/templates/lxc-oracle.in
> +++ b/templates/lxc-oracle.in
> @@ -142,6 +142,17 @@ EOF
>          sed -i 's|action $"Setting network parameters|# LXC action $"Setting network parameters|' $container_rootfs/etc/init.d/NetworkManager 2>/dev/null
>      fi
>  
> +    # sem_open(3) checks that /dev/shm is SHMFS_SUPER_MAGIC, so make sure to mount /dev/shm (normally done by dracut initrd) as tmpfs
> +    if [ $container_release_major = "4" -o $container_release_major = "5" ]; then
> +        echo "mount -t tmpfs tmpfs /dev/shm" >>$container_rootfs/etc/rc.sysinit
> +        echo "mount -t tmpfs tmpfs /dev/shm" >>$container_rootfs/etc/rc.d/rc.sysinit
> +    fi
> +
> +    if [ $container_release_major = "6" ]; then
> +        sed -i 's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|' $container_rootfs/etc/rc.sysinit
> +        sed -i 's|mount -n -o remount /dev/shm >/dev/null 2>&1$|mount -t tmpfs tmpfs /dev/shm # LXC|' $container_rootfs/etc/rc.d/rc.sysinit

I'm acking this anyway, but I'd point out that this looks like it
will turn out as a rootfs which no longer is booted under kvm the
exact same way as in a container.  It'll still boot so really no
big deal...

> +    fi
> +
>      # no need to attempt to mount /
>      sed -i 's|mount -f /$|# LXC mount -f /|' $container_rootfs/etc/rc.sysinit
>      sed -i 's|mount -f /$|# LXC mount -f /|' $container_rootfs/etc/rc.d/rc.sysinit
> -- 
> 1.8.1.4
> 
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list