Difference between revisions of "Share a directory among multiple guests"

From Linux-VServer

Jump to: navigation, search
m (Added infoirmation on fstab.)
(note restart need for runnning vservers)
Line 9: Line 9:
 
The following command will mount this directory for all guests:
 
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
 
  $ 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 ==
 
== fstab ==

Revision as of 15:49, 21 November 2007

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

Contents

Assumptions

Suppose you have multiple vserver guests at locations such as /var/lib/vservers/<guest>/. You would like to share a directory, such as /srv/common/home, among multiple guests. Each guest will be able to write to the directory.

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
Personal tools