<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 14 May 2008, at 11:52, Simon Wilcox wrote:</div><blockquote type="cite">What I'm looking for is a tool that can image a running partition and <br>copy it to the new device. The hardware profile will be different but <br>we're running stock kernels so I'm hopeful that they will cope.<br><br>Once we have the server running under VMware we can use rsync to copy <br>across the few changing files during a short downtime window.<br><br>It's getting the image across in the first place that I'm a bit stuck on.<br></blockquote><div><br class="webkit-block-placeholder"></div><div>You should be able to create an image with an empty disk and boot from</div><div>an ISO image containing a LiveCD. Here's a reasonable howto (ignore</div><div>the "install OS bit" - use a LiveCD that contains enough tools for you</div><div>to partition the disk and rsync over your "old" machine).</div><div><br class="webkit-block-placeholder"></div><div>Once that's done, this is a rough idea of how I did something similar</div><div>to migrate a server hosting several of our clients, including fairly high </div><div>traffic sites like <a href="http://www.squaremeal.co.uk">www.squaremeal.co.uk</a> (they've since been migrated onto </div></div><div>a cluster) into an OpenVZ container, with practically no downtime. Some</div><div>of it is OpenVZ specific, but the overall approach should work for most</div><div>virtualization methods:</div><div><br class="webkit-block-placeholder"></div><div>- I first rsync'ed the whole server into the directory used as the base</div><div>- I created the container config file.</div><div>- Assigned a new IP address (OpenVz will enforce this, so the virtual</div><div> container couldn't suddenly cause conflicts)</div><div>- Started the container</div><div>- I first tested that everything worked in the new setup, and shut down</div><div> a few services etc. that are not required in an OpenVZ container</div><div> (NTP for example gets handled on the host)</div><div>- Then I shut down and did one last rsync.</div><div>- Started it again.</div><div>- I assigned the old ip addresses to the server one by one.</div><div>- I then added the routing on the host required to reach the container.</div><div>- Then I started unilaterally sending ARP message from the container</div><div> using "arpsend", while in a different terminal I shut down the relevant</div><div> alias interface on the host I was moving from with ifconfig</div><div>- Repeat for all IP addresses to move.</div><div><br class="webkit-block-placeholder"></div><div>From a user POV, requests appeared to hang for up to a minute at most</div><div>per IP, though in practice requests got sent to the new one much quicker</div><div>(the purpose of the ARP send's being to ensure our firewall found the new</div><div>server right away instead of waiting for the arp cache entries to time out)</div><div><br></div><div>The only thing we lost was a couple of minutes of Apache log entries</div><div>and PHP sessions (which may of course be a dealbreaker depending on what </div><div>will happen if the sessions disappear - if something like that is an issue,</div><div>switching to a shared session mechanism first may be worthwhile) from</div><div>the last rsync until the IP takeover.</div><div><br></div><div>Vidar</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>-- </div><div>Vidar Hokstad</div><div>Technical Director</div><div>Aardvark Media Limited</div><div><div>Mobile: 0795 867 7857</div><div>Direct Dial: 020 7183 2740</div><div><br class="khtml-block-placeholder"></div><div>2 Fulham Business Exchange</div><div>The Boulevard</div><div>Imperial Wharf</div><div>London</div><div>SW6 2TL</div></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>