<?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=Jcrey</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=Jcrey"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Jcrey"/>
	<updated>2026-06-10T00:58:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12516</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12516"/>
		<updated>2012-06-08T11:24:52Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Other issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect these changes in /etc/vz/conf/123.conf&lt;br /&gt;
...&lt;br /&gt;
VE_PRIVATE=&amp;quot;/vz/private/$VEID&amp;quot;&lt;br /&gt;
VE_DEVICE=&amp;quot;/dev/sda1&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12515</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12515"/>
		<updated>2012-06-08T11:24:32Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Other issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect these changes in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
...&lt;br /&gt;
VE_PRIVATE=&amp;quot;/vz/private/$VEID&amp;quot;&lt;br /&gt;
VE_DEVICE=&amp;quot;/dev/sda1&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12514</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12514"/>
		<updated>2012-06-08T11:22:50Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Other issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
...&lt;br /&gt;
VE_DEVICE=/dev/sda1&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12513</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12513"/>
		<updated>2012-06-08T11:22:27Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Other issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
# /etc/vz/conf/123.conf:&lt;br /&gt;
...&lt;br /&gt;
VE_DEVICE=/dev/sda1&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12512</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12512"/>
		<updated>2012-06-08T11:19:16Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on context */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12511</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12511"/>
		<updated>2012-06-08T11:17:56Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on context */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12510</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12510"/>
		<updated>2012-06-08T11:15:51Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12509</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12509"/>
		<updated>2012-06-08T11:01:14Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Undo actions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has required a lot hard work for modifying vzmigrate to track undo actions when a error arises in the code. I felt free to reorganise undo actions in the function described on the following diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12508</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12508"/>
		<updated>2012-06-08T10:52:41Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can return the container to the previous state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12507</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12507"/>
		<updated>2012-06-08T10:51:08Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is something I thought about long ago, but I considered difficult to do in current &lt;br /&gt;
implementation. Now things have changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not take into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to modified vzmigrate ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12470</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12470"/>
		<updated>2012-05-31T08:39:34Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in '''vps.postumount''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12469</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12469"/>
		<updated>2012-05-31T08:38:13Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put in his moment off until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12468</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12468"/>
		<updated>2012-05-31T08:36:13Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on context */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, is the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12467</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12467"/>
		<updated>2012-05-31T08:35:53Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on the context */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12466</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12466"/>
		<updated>2012-05-31T08:35:34Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on the contexto */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the context ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12465</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12465"/>
		<updated>2012-05-31T08:34:12Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Other issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the contexto ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Links to vzmigrate modified ==&lt;br /&gt;
ftp://ftp.uma.es/pub/Linux/openvz/&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12464</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12464"/>
		<updated>2012-05-31T08:31:47Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Undo actions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the contexto ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12463</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12463"/>
		<updated>2012-05-31T08:31:25Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: /* Migrations depending on the contexto */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the contexto ==&lt;br /&gt;
[[Image:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12462</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12462"/>
		<updated>2012-05-31T08:30:41Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the contexto ==&lt;br /&gt;
[[Archivo:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_undo.jpeg&amp;diff=12461</id>
		<title>File:Vzmigrate undo.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_undo.jpeg&amp;diff=12461"/>
		<updated>2012-05-31T08:25:42Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: undo actions flowchart&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;undo actions flowchart&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_d2.jpeg&amp;diff=12460</id>
		<title>File:Vzmigrate d2.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_d2.jpeg&amp;diff=12460"/>
		<updated>2012-05-31T08:24:30Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: migration between insulated containers with share device&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;migration between insulated containers with share device&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_d1.jpeg&amp;diff=12459</id>
		<title>File:Vzmigrate d1.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_d1.jpeg&amp;diff=12459"/>
		<updated>2012-05-31T08:23:48Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: migration between insulated containers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;migration between insulated containers&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_c.jpeg&amp;diff=12458</id>
		<title>File:Vzmigrate c.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_c.jpeg&amp;diff=12458"/>
		<updated>2012-05-31T08:23:19Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: migration from insulated container to shared container&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;migration from insulated container to shared container&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_b.jpeg&amp;diff=12457</id>
		<title>File:Vzmigrate b.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_b.jpeg&amp;diff=12457"/>
		<updated>2012-05-31T08:20:56Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: migration from shared container to a insulated container&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;migration from shared container to a insulated container&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=File:Vzmigrate_a.jpeg&amp;diff=12456</id>
		<title>File:Vzmigrate a.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=File:Vzmigrate_a.jpeg&amp;diff=12456"/>
		<updated>2012-05-31T08:20:17Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: migration between containers without separate partitions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;migration between containers without separate partitions&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12455</id>
		<title>Vzmigrate filesystem aware</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Vzmigrate_filesystem_aware&amp;diff=12455"/>
		<updated>2012-05-31T08:18:46Z</updated>

		<summary type="html">&lt;p&gt;Jcrey: Created page with &amp;quot;== Motivation == Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Motivation ==&lt;br /&gt;
Reading thoroughly quick installation documentation, it says &amp;quot;It is recommended to use a separate partition for container's private directories (by default /vz/private/&amp;lt;veid&amp;gt;)&amp;quot;. As much as I searched the net, I have not found anything about it. &lt;br /&gt;
&lt;br /&gt;
This is a subject a thought about long ago, but I considered difficult to do in my actual &lt;br /&gt;
implementation. Now things had changed. I have received directives in my job to have each container in separated filesystems insulated from the rest of containers.&lt;br /&gt;
&lt;br /&gt;
Actually vzmigrate does not have into account this issue. vzmigrate assume data are available when migration occurs and it does not know about filesystems neither mounted filesystems at all.&lt;br /&gt;
&lt;br /&gt;
Because of this matters, this issue I had put off in his moment until new order has got back to the scene.&lt;br /&gt;
&lt;br /&gt;
Openvz has its own mechanisms to perform actions when starting a container. Migration knows about container state before migrating so after migrating data it can returns the container to the the same state.&lt;br /&gt;
&lt;br /&gt;
When considering migration that take into account insulated filesystems, it involve situations not considered by standard migration. By example, migrating a stopped container with its own filesystem, probably it will not have available its files because openvz supposedly will have scripts to unmount filesystem when container is stopped.&lt;br /&gt;
&lt;br /&gt;
I have modified migration script to adapt to these circumstances. I have named as '''shared''' those containers that share filesystem with others containers (legacy) and  those with their own filesystem as '''insulated'''. With this in mind, there are four migration scenario.&lt;br /&gt;
&lt;br /&gt;
* shared -&amp;gt; shared&lt;br /&gt;
* shared -&amp;gt; insulated&lt;br /&gt;
* insulated -&amp;gt; shared&lt;br /&gt;
* insulated -&amp;gt; insulated&lt;br /&gt;
&lt;br /&gt;
To get Openvz to know a container is mounted on its own filesystem, optional parameter '''VE_DEVICE''' is defined in configuration file.&lt;br /&gt;
&lt;br /&gt;
To get Openvz mount the filesystem before starting the container, '''vps.premount''' can have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
[ -d ${VE_PRIVATE} ] || mkdir ${VE_PRIVATE}&lt;br /&gt;
[ -n &amp;quot;$VE_DEVICE&amp;quot; ] &amp;amp;&amp;amp; mount ${VE_DEVICE} ${VE_PRIVATE} || echo -n &amp;quot; &amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly to get the filesystem unmounted after the container is stopped, we can have in vps.postumount:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
source ${VE_CONFFILE}&lt;br /&gt;
if [ -n &amp;quot;$VE_DEVICE&amp;quot; ]; then&lt;br /&gt;
   umount ${VE_PRIVATE} 2&amp;gt; /dev/null || echo -n &amp;quot;&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration along the use of a SAN, gives interesting advantages when migrating containers that last so long at sincronization phase. If the same device is presented in both HN, we can skip sincronization phase. Migration only have to unmount filesystem in source HN and mount the filesystem in target HN avoiding this way the copy of data.&lt;br /&gt;
&lt;br /&gt;
If we want to improve and minimize migration time, we could consider sharing another device for dump/undump container and share this way the file between HN. Using &lt;br /&gt;
this optional device can be set with configuration parameter '''VE_DUMP_DEVICE'''. This parameter has only meaning if we share between HN the device over which container is set up.&lt;br /&gt;
&lt;br /&gt;
== Migrations depending on the contexto ==&lt;br /&gt;
[[Archivo:Vzmigrate_a.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Migration in this case, as you would expect, es the same as always.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_b.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /derv/sdg1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_c.jpeg|400px]]&lt;br /&gt;
&lt;br /&gt;
Remove VE_DEVICE parameter from 123.conf and operate the same as shared-shared&lt;br /&gt;
&lt;br /&gt;
Mount/unmount container's filesystem if appropriated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_d1.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dst-device /dev/sdm1 HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_d2.jpeg|400px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a shared dump filesystem between HN.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzmigrate --dump-device /dev/VG/dump --online HN_target 123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Undo actions ==&lt;br /&gt;
The issue has got me a lot hard work when modifying vzmigrate is to track undo actions when a error arised in the code. May I permit to restructure undo actions in a function that follows the next diagram.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Vzmigrate_undo.jpeg|250px|center]]&lt;br /&gt;
&lt;br /&gt;
== Other issues ==&lt;br /&gt;
Creating a container over a insulated filesystem is not possible straightly because of vzctl complains if the the device is previously mounted under VE_PRIVATE. To overcome this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl create 123 --private /var/tmp/123&lt;br /&gt;
mkdir /vz/private/123;&lt;br /&gt;
mount /dev/sda1 /vz/private/123&lt;br /&gt;
mv /var/tmp/123/* /vz/private/123&lt;br /&gt;
# reflect this change in VE_PRIVATE parameter in /etc/vz/conf/123.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Jcrey</name></author>
		
	</entry>
</feed>