User Tools

Site Tools


openvz:migrate-vps-without-vzdump

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

openvz:migrate-vps-without-vzdump [2012-11-12 17:30]
kokkez created
openvz:migrate-vps-without-vzdump [2012-11-12 17:48] (current)
kokkez [A faster copy: tar then rsync]
Line 1: Line 1:
-=====Migrate OpenVZ to another OpenVZ host without vzdump (using rsync)=====+====== Migrate a VPS without vzdump (using rsync) == 
 + 
 +Borrowed from: [[http://wiki.frantech.ca/doku.php/migrate_openvz|wiki.frantech.ca]]
  
 BuyVM does not support creating or restoring vzdump backups. If you'd like to attempt a semi-automated method of migrating OpenVZ without vzdump, read on. BuyVM does not support creating or restoring vzdump backups. If you'd like to attempt a semi-automated method of migrating OpenVZ without vzdump, read on.
  
-**__Warning! This can easily hose your target system, especially if the transfer is disrupted.__** ++++Why?+=== Warning! This can easily hose your target system, especially if the transfer is disrupted. == 
-Many parts of the linux environment are co-dependent. Of specific relevance to this operation are the +**Why?** many parts of the linux environment are co-dependent. Of specific relevance to this operation are the 
-interdependence of programs and library fileslibc version, authentication framework and authentication +interdependence of programs and library fileslibc version, authentication framework and authentication 
-file format; and availability of home folders. If these three things can be maintained, you can at least+file formatavailability of home folders. If these three things can be maintained, you can at least
 log in to the target system and run utilities after migration. log in to the target system and run utilities after migration.
-++++ 
  
-**__Please take care to back up your data first. Preferably from both systems.__** ++++Why?+=== Please take care to back up your data first. Preferably from both systems. == 
-Copying an entire system is a destructive process. The destination system at least will be (completely?) destroyed and restored as a replica of your old system; if you have anything you want to save on there, get it backed up off-system. If, by some unlucky event, you typed a bad command into the source system, you're operating with enough privileges that the system can be permanently damaged. So back up both system. +**Why?** copying an entire system is a destructive process. The destination system at least will be (completely?) destroyed and restored as a replica of your old system; if you have anything you want to save on there, get it backed up off-system. If, by some unlucky event, you typed a bad command into the source system, you're operating with enough privileges that the system can be permanently damaged. So back up both system.
-+++++
  
-**__I cannot stress enough how easily this can leave your system in a state where it needs to be re-imaged.__** ++++Why?+=== I cannot stress enough how easily this can leave your system in a state where it needs to be re-imaged. == 
-No really, it's very easy. Should the connection get disrupted and you get a partially unpacked system, that system likely won't boot, you're shell utilities probably won't work and in general it'll create serious headaches. So be careful and follow the instructions. +**Why?** no really, it's very easy. Should the connection get disrupted and you get a partially unpacked system, that system likely won't boot, you're shell utilities probably won't work and in general it'll create serious headaches. So be careful and follow the instructions.
-+++++
  
-**__Never attempt to migrate an OpenVZ to a dedicated or KVM unless you know what you're doing.__** ++++Why?+=== Never attempt to migrate an OpenVZ to a dedicated or KVM unless you know what you're doing. == 
-OVZ images often do not include certain files that make no sense to it, for example a linux kernel or a /boot folder. These are critical to booting hardware or hardware emulated systems. At this point you've walked beyond the scope of this document: Beware, here be dragons. +**Why?** OVZ images often do not include certain files that make no sense to it, for example a linux kernel or a ''/boot'' folder. These are critical to booting hardware or hardware emulated systems. At this point you've walked beyond the scope of this document: Beware, here be dragons. 
-+++++ 
 +---- 
 + 
 +===== Method overview ==
  
 This method works best run from the openvz system console. Most vps providers have a shell console you can access. Log into that shell on both machines and go through each active service and turn it off. Using ''kill'' may cause open files to be left in an inconsistent state, especially for SQL servers, so please shut them down gracefully. The only active service that should be running on the target machine is ''ssh''. This method works best run from the openvz system console. Most vps providers have a shell console you can access. Log into that shell on both machines and go through each active service and turn it off. Using ''kill'' may cause open files to be left in an inconsistent state, especially for SQL servers, so please shut them down gracefully. The only active service that should be running on the target machine is ''ssh''.
Line 29: Line 31:
  
 Create the file ''/dev/shm/exclude.txt'' with the following contents: Create the file ''/dev/shm/exclude.txt'' with the following contents:
- 
 <code> <code>
 /dev/* /dev/*
Line 37: Line 38:
  
 If you have any large data folders that can be copied after the core system has been transferred, exclude them now as well. If you have any large data folders that can be copied after the core system has been transferred, exclude them now as well.
 +
 +==== Using `rsync` ==
  
 Run the following command on the source host: Run the following command on the source host:
Line 50: Line 53:
 You may get a warning when re-running rsync that your sshd's host key has changed, that's normal. The previous command copied the host key from your old host. You may get a warning when re-running rsync that your sshd's host key has changed, that's normal. The previous command copied the host key from your old host.
  
-Run the reboot command to restart the destination host.+Execute the ''reboot'' command to restart the destination host.
  
-==== A faster copy: tar then rsync ====+==== A faster copy: `tarthen `rsync====
  
 Since a linux system is largely small files, it is usually faster to tar them up before transfer as rsync checks each file. Instead of checking each file, this merely replaces everything it finds from the old system on the new system. Since a linux system is largely small files, it is usually faster to tar them up before transfer as rsync checks each file. Instead of checking each file, this merely replaces everything it finds from the old system on the new system.
openvz/migrate-vps-without-vzdump.1352737821.txt.gz · Last modified: 2012-11-12 17:30 (external edit)