Mounting a Host Directory in LXC - (Sharing a directory between Host and Guest)

New addition to my openSUSE wiki describing

LXC (Linux Containers)
Probably the best method for mounting a Host directory into a Container (Guest).
https://en.opensuse.org/User:Tsu2/LXC_mount_shared_directory

Although there are many ways described how to share a directory, this method avoids cluttering your Guests with internal config files.
This method only requires the Container to be configured with a directory as a mount point. Everything else happens outside the Guest.

Describes
Setting up the shared directory on the Host. This directory can then be used not only as a shared FS directory in any number of Containers, it can be accessed by libvirt Guests using another of my Wiki pages (https://en.opensuse.org/User:Tsu2/virtfs#Overview), for example running KVM or Xen guests simultaneously as well.

Setting up the Container config file.

If you’re running LXC possibly with Xen or KVM, enjoy!

TSU

PS.
For any LXC users, it looks like SUSE Documentation just posted a new “How To” which looks mostly OK…
https://www.suse.com/documentation/sles11/singlehtml/lxc_quickstart/lxc_quickstart.html
Some minor corrections need to be made, but is a good start for anyone new to LXC… Except! - In my own LXC how-to (which itself sorely needs updating) I highly recommend replacing the conventional steps to create a bridge (br0) in YAST with what I feel is a far superior path using libvirt (vm manager) (typically virbr0).

Minor modification description, the following does not read correctly.

This method only requires the Container to be configured with a directory as a mount point.

Should instead be something like

The guide configures existing directory or a new folder in the Container to be used as a mount point but does not require modifying any configurations like fstab in the container. (Everything else happens outside the Guest and is passed into the Guest).

TSU