Cloning Disks using dd & cat commands for Linux systems
Last updated on March 12th, 2018 at 07:45 pm
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 of the Linux systems.
(Recommended Read: Commands to check System & Hardware Information)
dd command is the good Linux tool for cloning disks & 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
dd is 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 has a number of functions i.e. it can be used 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 great command which has a number of options but 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.
Both of these commands can accomplish the task i.e. to take backup/clone whole drive. Its upto 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 on for cloning disks using dd & cat commands. If having any queries/suggestions, do mention them below & I will surely address them. ADIOS !!!