How to Clone a Partition or Hard drive in Linux

There are many reasons why you may want to clone a Linux partition or even hard drive, most of which are related to creating backups of your data. There are multiple ways you can achieve this in Linux by using some external tools such as partimage or Clonezilla.

However in this tutorial we are going to review Linux disk cloning with tool called dd, which is most commonly used to convert or copy files and it comes pre-installed in most Linux distributions.

How to Clone Linux Partition

With dd command you can copy entire hard drive or just a Linux partition. Lets start with cloning one of our partitions. In my case I have the following drives: /dev/sdb, /dev/sdc.. I will clone /dev/sdb1/ to /dev/sdc1.

Read Also: How to Clone Linux Partitions Using ‘cat’ Command

First list the these partitions using the fdisk command as shown.

# fdisk -l /dev/sdb1/ /dev/sdc1
List Linux Partitions
List Linux Partitions

Now clone a partition /dev/sdb1/ to /dev/sdc1 using the following dd command.

# dd if=/dev/sdb1  of=/dev/sdc1 

The above command tells dd to use /dev/sdb1 as input file and write it to output file /dev/sdc1.

Clone Linux Partition with dd Command
Clone Linux Partition with dd Command

After cloning Linux partition, you can then check both partitions with:

# fdisk -l /dev/sdb1 /dev/sdc1
Verify Linux Partition Cloning
Verify Linux Partition Cloning

How to Clone Linux Hard Drive

Cloning a Linux hard drive is similar to cloning a partition. However, instead of specifying the partition, you just use the entire drive. Note that in this case it is recommended that the hard drive is same in size (or bigger) than the source drive.

# dd if=/dev/sdb of=/dev/sdc
Clone Hard Drive in Linux
Clone Hard Drive in Linux

This should have copied the drive /dev/sdb with its partitions on the target hard drive /dev/sdc. You can verify the changes by listing both drives with fdisk command.

# fdisk -l /dev/sdb /dev/sdc
Verify Linux Hard Drive Cloning
Verify Linux Hard Drive Cloning

How to Backup MBR in Linux

dd command can also be used to backup your MBR, which is located at the first sector of the device, before the first partition. So if you want to create backup of your MBR, simply run:

# dd if=/dev/sda of=/backup/mbr.img bs=512 count=1. 

The above command tells dd to copy /dev/sda to /backup/mbr.img with step of 512 bytes and the count option tells to copy only 1 block. In other words you tell dd to copy the first 512 bytes from /dev/sda to the file you have provided.

Backup MBR in Linux
Backup MBR in Linux

That’s all! dd command is a powerful Linux tool that should be used with caution when copying or cloning Linux partitions or drives.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

7 thoughts on “How to Clone a Partition or Hard drive in Linux”

  1. Two interesting option :

    1. status=progress – this gives progress status during the copy.
    2. bs= 16K – fix the block size to 16 Kilobytes, this increases the speed (you can select other values but the default one is too small and reduces the bandwidth).


  2. Well, after working for an hour or so – without error message – it bricked my system completely. Also the so much favored “Boot Repair Disk” made the catastrophe even worse. The problem seems the discrepancy of the sector size in both partitions.

    Only my Windows System boots ok – but with mysterious error messages.

    So this is not the solution to my problem. I can start from scratch now and install a new system.

  3. Are you referring dd related to OS disk ? dd is mostly used to copy data (disk dump) from one disk to another as cp is not copying entire data completely.

    In case of physical servers mostly H/W raids are configured as RAID 1 for OS. For data volumes if required you can create mirrored volume in LVM or if you are using Veritas you can create desired RAID.

    Rsync will be good option as it is also used as data replication across site as well as locally .


  4. The big problem with dd is that if an error is found, when it is cloning, it stops. But this can be avoided adding: conv=sync,noerror

    • @Romualdo,

      Yes, I do agree with you, even i have faced many times with dd command. Thanks for sharing the tip, never heard about this options..


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.