It always wise for a System Administrator to be prepared for the worst situation & having a backup/clones of servers, when such a day arrives will certainly make your job & life easy. Though there are a number of options to choose from to create a clones of your HDdrives like Clonezilla, Redo backup, Mondo Rescue etc but here in this post, we will not discuss 3rd party tools but will use dd command & cat command to complete cloning disks in Linux.

(Recommended Read: Commands to check System & Hardware Information)


dd Command

dd command is a good tool for cloning disks in Linux & is available on almost all Linux distributions. But beware a little mistake and you can end up destroying your partition, so be very sure to double-check before executing the command.

So, the Syntax used to Clone a partition or whole drive is

 $ dd if=/dev/sda1 of=/dev/sdb1

 how to use dd command in linux

 where,

'dd' is the command,

'If' is the input drive, from where files are to be cloned i.e./dev/sda1,

'Of' is the output drive to which files are cloned i.e./dev/sdb1.

It's simple right but again I warn you to use the syntax properly as it can also delete your HDD.


cat Command

cat command has a number of functions i.e. it can be used to create files, you can use it to read files, or can also combine 2 files (read article HERE) but it can also be used to clone/backup a complete drive. Though dd is a great command which has a number of options, cat command fares better when it comes to speed & performance.

Syntax for cat command :-

$ cat /dev/sda1 > /dev/sdb1

where, cat is the command,

/dev/sda1 is the input drive,

and, /dev/sdb1 is the output drive.

how to use dd command in linux

Both of these commands can accomplish the task i.e. to take backup/clone the whole drive. It's up to your personal preference which one to choose from. In my future posts, I will try to discuss some other backup/cloning solutions.

So this was our tutorial how to use CAT & DD command in Linux to Clone Disks. If having any queries/suggestions, do mention them below & I will surely address them. ADIOS !!!

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

Linux TechLab is thankful for your continued support.