Share a directory among multiple guests: Difference between revisions

From Linix VServer
Jump to navigationJump to search
(note restart need for runnning vservers)
Line 1: Line 1:
How to share a directory, such as <code>/home</code>, among multiple vserver guests.
How to share a directory, such as <code>/home</code>, among multiple vserver guests.
__TOC__
__TOC__
== Assumptions ==
Comprehensive Work, I liked It, Thanks
Suppose you have multiple vserver guests at locations such as <code>/var/lib/vservers/<guest>/</code>.
You would like to share a directory, such as <code>/srv/common/home</code>, among multiple guests.
Each guest will be able to write to the directory.


== Command ==
== Command ==

Revision as of 23:24, 15 December 2008

How to share a directory, such as /home, among multiple vserver guests.

Comprehensive Work, I liked It, Thanks

Command

The following command will mount this directory for all guests:

$ for guest in /var/lib/vservers/*; do mount --bind /srv/common/home ${guest}/home; done

Note that you might have to (re)start your vserver AFTER the mount for the shared path to be visible under it.

fstab

Alternatively, you may add an entry similar to the below one in /etc/vservers/<guest>/fstab:

/srv/common/home       /home    none    bind    0 0

See also

  • $ man mount