Difference between revisions of "Share a directory among multiple guests"
From Linux-VServer
m (Share a directory among multiple vserver guests moved to Share a directory among multiple guests: Having "vserver" in the page title is probably redundant.) |
m (Added infoirmation on fstab.) |
||
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== | + | == Assumptions == |
Suppose you have multiple vserver guests at locations such as <code>/var/lib/vservers/<guest>/</code>. | 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. | 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. | Each guest will be able to write to the directory. | ||
− | ==Command== | + | |
+ | == 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 | $ for guest in /var/lib/vservers/*; do mount --bind /srv/common/home ${guest}/home; done | ||
− | ==See also== | + | |
+ | == fstab == | ||
+ | Alternatively, you may add an entry similar to the below one in <code>/etc/vservers/<guest>/fstab</code>: | ||
+ | /srv/common/home /home none bind 0 0 | ||
+ | |||
+ | == See also == | ||
* <code>$ man mount</code> | * <code>$ man mount</code> |
Revision as of 02:36, 15 September 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
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