This shows you the differences between two versions of the page.
openvz:migrate-vps-without-vzdump [2012-11-12 17:40] kokkez |
openvz:migrate-vps-without-vzdump [2012-11-12 17:48] (current) kokkez [A faster copy: tar then rsync] |
||
---|---|---|---|
Line 18: | Line 18: | ||
=== Never attempt to migrate an OpenVZ to a dedicated or KVM unless you know what you're doing. == | === Never attempt to migrate an OpenVZ to a dedicated or KVM unless you know what you're doing. == | ||
- | **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. | + | **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 == | ===== 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 30: | 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 38: | 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 51: | 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: `tar` then `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. |