Differences
This shows you the differences between two versions of the page.
|
|
— |
disaster_recovery [2014/11/24 01:14] (current) 0.0.0.0 created |
| ====== Disaster_Recovery ====== |
| |
| ===== Moving disk partitions from one machine to another ===== |
| If a disk is about to fail, and you need to create a backup of a partition on another machine, you can use dd and netcat (and optionally pv) to copy the partition over the network. |
| |
| Run the following command on the machine that is to receive the backup. In this case, <tt>-p 3333</tt> specifies the port to listen on</tt>, <tt>-s 10737418240</tt> is the expected size of the partition (10gb here) in bytes, and finally <tt>of=/path/to=backup.img</tt> is where the backup will end up. You can of course use another partition, such as an lvm partition, as the location for the backup. Using <tt>pv</tt> causes progress information to be displayed; omit the pipe to pv if you don't want/need this information. |
| {{Root|<source lang="bash"> |
| nc -l -p 3333 | pv -p -r -b -e -t -s 10737418240 | dd of=/path/to/backup.img bs=4096 |
| </source>}} |
| |
| To send the partition to the backup machine, run this comand on the machine that has the failing disk. Here, <tt>if=/dev/failed-disk</tt> is the device node for the partition to be backed up, and <tt>backup-machine.example.com 3333</tt> is the hostname or ip address of the other machine to send the backup to, along with the port number specified above. |
| {{Root|<source lang="bash"> |
| dd if=/dev/failed-disk bs=4096 | pv -b -p -r -t -e -s 107374182400 | nc backup-machine.example.com 3333 |
| </source>}} |
| |
| ===== See Also ===== |
| * http://www.linuxjournal.com/content/copying-filesystem-between-computers |
| * http://www.ivarch.com/programs/quickref/pv.shtml or <tt>man pv</tt> |