<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bsv999</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bsv999"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Bsv999"/>
	<updated>2026-06-10T03:00:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Mounting_filesystems&amp;diff=6257</id>
		<title>Mounting filesystems</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Mounting_filesystems&amp;diff=6257"/>
		<updated>2008-07-30T14:25:36Z</updated>

		<summary type="html">&lt;p&gt;Bsv999: /* Requirement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Mounting filesystems within a container ==&lt;br /&gt;
&lt;br /&gt;
To mount filesystems inside a container, you have several choices:&lt;br /&gt;
&lt;br /&gt;
* NFS (the container will be an NFS Client) - see [[NFS]]&lt;br /&gt;
* FUSE - see [[FUSE]]&lt;br /&gt;
* Bind mount from Hardware Node&lt;br /&gt;
&lt;br /&gt;
=== Bind mount from Hardware Node ===&lt;br /&gt;
&lt;br /&gt;
Recent Linux kernels support an operation called 'bind mounting' which makes part of a mounted filesystem visible at some other mount point. See 'man bind' for more information.&lt;br /&gt;
&lt;br /&gt;
Bind mounts can be used to make directories on the hardware node visible to the container.&lt;br /&gt;
&lt;br /&gt;
OpenVZ uses two directories. Assuming our container is numbered 777, these directories are:&lt;br /&gt;
&lt;br /&gt;
 $VZROOT/private/777&lt;br /&gt;
 $VZROOT/root/777&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;$VZROOT&amp;lt;/code&amp;gt; is usually &amp;lt;code&amp;gt;/vz&amp;lt;/code&amp;gt;, on Debian systems however this is &amp;lt;code&amp;gt;/var/lib/vz&amp;lt;/code&amp;gt;. In this document this is further referred to as &amp;lt;code&amp;gt;$VZROOT&amp;lt;/code&amp;gt; -- substitute it with what you have.}}&lt;br /&gt;
&lt;br /&gt;
The $VZROOT/private directory contains root directory contents. This directory or subdirectory may be symlinked onto a different file system, for example:&lt;br /&gt;
&lt;br /&gt;
  $VZROOT/private -&amp;gt; /mnt/openvz&lt;br /&gt;
&lt;br /&gt;
Putting container root directories onto a separate file system (not the hardware node root file system) is good storage management practice. It protects the Hardware Node root file system from being filled up by a container; this could cause problems on the Hardware Node.&lt;br /&gt;
&lt;br /&gt;
=== Requirement ===&lt;br /&gt;
&lt;br /&gt;
'''On the HN we have a directory &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; which we wish to make available (shared) to all containers.'''&lt;br /&gt;
&lt;br /&gt;
You would think that you could bind mount this directory, as in: &amp;lt;code&amp;gt;mount --bind /home $VZROOT/private/777/home&amp;lt;/code&amp;gt; but this does not work — the contents of &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; cannot be seen within the container.&lt;br /&gt;
&lt;br /&gt;
This is where the second directory listed above (&amp;lt;code&amp;gt;$VZROOT/root/777&amp;lt;/code&amp;gt;) is used. If a container is not started, this directory is empty. But after starting a container, this directory contains what the container sees as its mounted file systems.&lt;br /&gt;
&lt;br /&gt;
The correct command to issue on the HN is:&lt;br /&gt;
&lt;br /&gt;
  mount --bind /home $VZROOT/root/777/home&lt;br /&gt;
&lt;br /&gt;
The container must be started and the destination directory must exist. The container will see this directory mounted like this:&lt;br /&gt;
&lt;br /&gt;
 # df&lt;br /&gt;
 Filesystem           1K-blocks      Used Available Use% Mounted on&lt;br /&gt;
 simfs                 10485760    298728  10187032   3% /&lt;br /&gt;
 tmpfs                   484712         0    484712   0% /lib/init/rw&lt;br /&gt;
 tmpfs                   484712         0    484712   0% /dev/shm&lt;br /&gt;
 ext3                 117662052 104510764   7174408  94% /home&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Attention ===&lt;br /&gt;
&lt;br /&gt;
Partition with &amp;lt;b&amp;gt;reiserfs&amp;lt;/b&amp;gt; file system don't mounted in container now (may be later). You can mount reiserfs on the HN added two rows in /etc/vz/cron:&lt;br /&gt;
&lt;br /&gt;
 # Mount disks after reboot.&lt;br /&gt;
 */5 * * * * root mount /dev/sda1 $VZROOT/root/777/mnt/sda1&lt;br /&gt;
&lt;br /&gt;
Partition /dev/sda1 be mount after VE 777 is started.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Bsv999</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Mounting_filesystems&amp;diff=6256</id>
		<title>Mounting filesystems</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Mounting_filesystems&amp;diff=6256"/>
		<updated>2008-07-30T14:24:09Z</updated>

		<summary type="html">&lt;p&gt;Bsv999: /* Requirement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Mounting filesystems within a container ==&lt;br /&gt;
&lt;br /&gt;
To mount filesystems inside a container, you have several choices:&lt;br /&gt;
&lt;br /&gt;
* NFS (the container will be an NFS Client) - see [[NFS]]&lt;br /&gt;
* FUSE - see [[FUSE]]&lt;br /&gt;
* Bind mount from Hardware Node&lt;br /&gt;
&lt;br /&gt;
=== Bind mount from Hardware Node ===&lt;br /&gt;
&lt;br /&gt;
Recent Linux kernels support an operation called 'bind mounting' which makes part of a mounted filesystem visible at some other mount point. See 'man bind' for more information.&lt;br /&gt;
&lt;br /&gt;
Bind mounts can be used to make directories on the hardware node visible to the container.&lt;br /&gt;
&lt;br /&gt;
OpenVZ uses two directories. Assuming our container is numbered 777, these directories are:&lt;br /&gt;
&lt;br /&gt;
 $VZROOT/private/777&lt;br /&gt;
 $VZROOT/root/777&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;$VZROOT&amp;lt;/code&amp;gt; is usually &amp;lt;code&amp;gt;/vz&amp;lt;/code&amp;gt;, on Debian systems however this is &amp;lt;code&amp;gt;/var/lib/vz&amp;lt;/code&amp;gt;. In this document this is further referred to as &amp;lt;code&amp;gt;$VZROOT&amp;lt;/code&amp;gt; -- substitute it with what you have.}}&lt;br /&gt;
&lt;br /&gt;
The $VZROOT/private directory contains root directory contents. This directory or subdirectory may be symlinked onto a different file system, for example:&lt;br /&gt;
&lt;br /&gt;
  $VZROOT/private -&amp;gt; /mnt/openvz&lt;br /&gt;
&lt;br /&gt;
Putting container root directories onto a separate file system (not the hardware node root file system) is good storage management practice. It protects the Hardware Node root file system from being filled up by a container; this could cause problems on the Hardware Node.&lt;br /&gt;
&lt;br /&gt;
=== Requirement ===&lt;br /&gt;
&lt;br /&gt;
'''On the HN we have a directory &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; which we wish to make available (shared) to all containers.'''&lt;br /&gt;
&lt;br /&gt;
You would think that you could bind mount this directory, as in: &amp;lt;code&amp;gt;mount --bind /home $VZROOT/private/777/home&amp;lt;/code&amp;gt; but this does not work — the contents of &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; cannot be seen within the container.&lt;br /&gt;
&lt;br /&gt;
This is where the second directory listed above (&amp;lt;code&amp;gt;$VZROOT/root/777&amp;lt;/code&amp;gt;) is used. If a container is not started, this directory is empty. But after starting a container, this directory contains what the container sees as its mounted file systems.&lt;br /&gt;
&lt;br /&gt;
The correct command to issue on the HN is:&lt;br /&gt;
&lt;br /&gt;
  mount --bind /home $VZROOT/root/777/home&lt;br /&gt;
&lt;br /&gt;
The container must be started and the destination directory must exist. The container will see this directory mounted like this:&lt;br /&gt;
&lt;br /&gt;
 # df&lt;br /&gt;
 Filesystem           1K-blocks      Used Available Use% Mounted on&lt;br /&gt;
 simfs                 10485760    298728  10187032   3% /&lt;br /&gt;
 tmpfs                   484712         0    484712   0% /lib/init/rw&lt;br /&gt;
 tmpfs                   484712         0    484712   0% /dev/shm&lt;br /&gt;
 ext3                 117662052 104510764   7174408  94% /home&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Attention:&lt;br /&gt;
Partition with &amp;lt;b&amp;gt;reiserfs&amp;lt;/b&amp;gt; file system don't mounted in container now (may be later). You can mount reiserfs on the HN added two rows in /etc/vz/cron:&lt;br /&gt;
&lt;br /&gt;
 # Mount disks after reboot.&lt;br /&gt;
 */5 * * * * root mount /dev/sda1 $VZROOT/root/777/mnt/sda1&lt;br /&gt;
&lt;br /&gt;
Partition /dev/sda1 be mount after VE 777 is started.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Bsv999</name></author>
		
	</entry>
</feed>