• : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /home/tcdaemon/tygerclan-Prod/site/includes/file.inc on line 649.

Cloning Partitions Across SSH

Many times I've had to image/clone partitions of the machines across and SSH contection.  Often there is not sufficient space to compress the whole image and transfer it over to the new machine and the desploy it inside that machine. This is very common with VPS providers. 

Instructions

Boot up both machines in single user mode or with a boot CD. I like using rescue CDs/OSs. Make sure all of the source partitions and destination partitions are unmounted or mounted read-only. Also make sure the user you are working with has the premissions to write disk's partition devices. 

#> dd if={source partition device}| gzip -1 - | ssh {destination host} 'gunzip - | dd of={target partition device}'

While it isn't required to gzip the data stream, it it highly recommended. If you don't, you'll be wasting lots of time and bandwidth transfering empty space. 

Example 

dd if=/dev/sda2 |gzip -1 - | ssh root@vps.example.com 'gunzip - |dd of=/dev/xvdb'