User Tools

Site Tools



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. <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> 3333</tt> is the hostname or ip address of the other machine to send the backup to, along with the port number specified above. <source lang="bash"> dd if=/dev/failed-disk bs=4096 | pv -b -p -r -t -e -s 107374182400 | nc 3333 </source>

See Also

disaster_recovery.txt · Last modified: 2014/11/24 01:14 by