Register now and start sharing your code snippets.
-->

Transfer partition from one server to another

Shell Script (Bash) posted 11 months ago by christian

The following is an example of how to transfer a partition from one server to another.

In the example, I first create a file containing the partition, and then transfer the partition to the other server.

   1  dd if=/dev/xen-1/aktagon.com-disk of=/tmp/file
   2  scp /tmp/file username@host:/file

I then SSH to the other server and create the partition from the file.

   1  ssh host
   2  lvcreate -L 4G /dev/VG00/aktagon.com-disk
   3  cat aktagon.com-disk.bz2 > /dev/aktagon-1/aktagon.com-disk

Remember to create a backup before running these commands.

Tagged lvm, backup, transfer