Clone linux disk partition over a network using dd

linux clone

In this tutorial we will show you how to clone linux harddisk partition over a network, in this tutorial we will use dd command. For you don’t know dd is a command-line utility for Unix and Unix-like operating systems whose primary purpose is to convert and copy files.

Clone linux harddisk has advantages because we don’t need to reinstall and configure again the applications especially in linux that we used as server.

Prerequisites

This article assumes you have at least basic knowledge of linux, know how to use the shell, root user or non-root user account with sudo privileges set up on your server.

For other prerequisites :

  • Linux with network interface.
  • Make sure 2 linux have same storage size.
  • Both 2 linux has been booted using rescue OS or other live OS , so you not boot using installed OS in the disk.

We will use description for our example

Source

server-A : /dev/sda

Destination

server-B : /dev/sda

Warning : Make sure all command below are executed under your rescue’s operating system

1. Clone disk paritition using dd over SSH

To clone entire linux disk partition using dd over ssh from server-A to server-B. Lets assume you use root user

Run this command in server A (source)

If you want to clone some partition only , just choose partition you want to clone like these command below, for example we will clone /dev/sda3 partition

Run this command in server A (source)

2. Clone disk patition using dd over telnet with bzip compression

Clone using telnet and bzip has advantages reduce clone time, but make sure you using secure network.

Lets assume server-B has ip address 192.168.100.2

Run this command in server B (destination)

Run this command in server A (source)

Based on these 2 commands above we will connect to server-B using port 19000.

Conclusion

You can choose 2 kinds of method above, clone disk partition over network is useful when you need to migration from different datacenter with same disk storage space.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *