Find out how to Clone a Partition or Laborious drive in Linux
There are various explanation why chances are you’ll wish to clone a Linux partition and even arduous drive, most of that are associated to creating backups of your information. There are a number of methods you’ll be able to obtain this in Linux through the use of some exterior instruments reminiscent of partimage or Clonezilla.
Nevertheless on this tutorial we’re going to assessment Linux disk cloning with instrument referred to as dd, which is mostly used to transform or copy recordsdata and it comes pre-installed in most Linux distributions.
Find out how to Clone Linux Partition
With dd command you’ll be able to copy total arduous drive or only a Linux partition. Lets begin with cloning considered one of our partitions. In my case I’ve the next drives: /dev/sdb, /dev/sdc.. I’ll clone /dev/sdb1/ to /dev/sdc1.
Learn Additionally: Find out how to Clone Linux Partitions Utilizing ‘cat’ Command
First record the these partitions utilizing the fdisk command as proven.
# fdisk -l /dev/sdb1/ /dev/sdc1
Now clone a partition /dev/sdb1/ to /dev/sdc1 utilizing the next dd command.
# dd if=/dev/sdb1 of=/dev/sdc1
The above command tells dd to make use of /dev/sdb1 as enter file and write it to output file /dev/sdc1.
After cloning Linux partition, you’ll be able to then verify each partitions with:
# fdisk -l /dev/sdb1 /dev/sdc1
Find out how to Clone Linux Laborious Drive
Cloning a Linux arduous drive is just like cloning a partition. Nevertheless, as an alternative of specifying the partition, you simply use all the drive. Observe that on this case it is strongly recommended that the arduous drive is identical in dimension (or larger) than the supply drive.
# dd if=/dev/sdb of=/dev/sdc
This could have copied the drive /dev/sdb with its partitions on the goal arduous drive /dev/sdc. You may confirm the modifications by itemizing each drives with fdisk command.
# fdisk -l /dev/sdb /dev/sdc
Find out how to Backup MBR in Linux
dd command will also be used to backup your MBR, which is positioned on the first sector of the gadget, earlier than the primary partition. So if you wish to create backup of your MBR, merely run:
# dd if=/dev/sda of=/backup/mbr.img bs=512 depend=1.
The above command tells dd to repeat /dev/sda to /backup/mbr.img with step of 512 bytes and the depend choice tells to repeat solely 1 block. In different phrases you inform dd to repeat the primary 512 bytes from /dev/sda to the file you could have offered.
That’s all! dd command is a strong Linux instrument that ought to be used with warning when copying or cloning Linux partitions or drives.