The way to Clone Your Linux Arduous Drive: Four Strategies

Just because you're using a Linux operating system doesn't mean you won't run into problems from time to time. It's always good to have a backup plan in place just in case a problem arises. A rare Linux virus may be attacking. You may be attacked by ransomware scammers. The hard disk drive (HDD) may fail.

Clone Linux HDD feature

By cloning your Linux hard drive, you create a disk image that can be restored later. But how do you clone your Linux hard drive?

An error may occur with your Linux installation. You may be upgrading your hard drive to a larger volume. Whatever the problem, when you have a backup of your hard drive, it's relatively easy to get things back up and running.

Best way backup computer

Linux offers four disk cloning solutions that you should consider:

  1. dd

  2. Partial image

  3. Partclone

  4. Clonezilla

Whether you're using features built into your Linux operating system or installing a third-party tool, it shouldn't be long before you can get your system back up and running.

Let's look at the four main options for cloning a drive on Linux.

Perhaps the most powerful Linux tool of all, dd (sometimes called a "Disk Destroyer") can clone an entire hard drive or hard drive partition to another. In the event of misuse, however, the contents of your hard drive can be deleted.

Hence, you should use it with extreme care. You can find dd built into most Linux operating systems. If not, install it through the package manager. Use the following command to clone your computer hard drive:

dd if = / dev / sdX from = / dev / sdY bs = 64K conv = noerror, sync

Here sdX is the source disk while sdY is the destination. The numerical value 64K corresponds to the block size command bs. The default is 512 bytes, which is very small. So it is best to include 64 KB or the larger 128 KB as a condition. However, while a larger block size speeds up the transfer, a smaller block size makes the transfer more reliable.

If you only want to clone one partition of your drive, use

dd if = / dev / sda1 from = / dev / sdb1 bs = 64K conv = noerror, sync

As you can see partition sda1 (i.e. partition 1 on device sda) is cloned to sdb1 (a newly created partition 1 on device sdb), e.g. B. a secondary or external hard drive attached to your computer.

Tap Enter to execute the command. How long it takes depends on the size of the hard drive or partition. Just make sure the target volume is big enough to save!

Clone your Linux partitions

If you have problems getting to grips with the instructions with dd, or if you prefer to avoid accidentally erasing your hard drive with typing errors, partimage is also available for most distributions and does not pose any risk to "Disk Destroyer"!

Partimage does not support the ext4 file system, however. Therefore, do not use it to clone disks or partitions of this type. However, if necessary, Windows hard drive formats (FAT32 or NTFS, although this is experimental), as well as the most widely used Linux file system ext3 and other older alternatives can be cloned.

Before starting, make sure the partition you want to clone is not mounted (using the umount command). Otherwise, you will have to exit partimage to do this before you can continue with the process. You can always quit with that F6 Key.

For Ubuntu, install with:

sudo apt install partimage

Start from the command line with:

sudo partimage

This is a mouse-driven application that requires you to first select the partition to clone.

Select a partition to be cloned

Then tap the arrow buttons on the right to go to the next section Image file to create / use and give it a name (or enter the filename of the image you want to restore).

Choose the right one Action to be taken (Make sure the option you choose is starred) and press F5 Continue. Select the option on the following screen Compression leveland your favorite Options. You also have the option to set an image split mode and an instruction of what to do after the backup.

Choose an appropriate compression level

Tap F5 To continue, confirm the details, and then tap OK to begin the process. The speed depends on the performance of your computer.

Clone your Linux partition

If you're looking for a quick and dirty, but safe, hard drive cloning solution for Linux, use partimage.

3. Partclone: ​​Partition imaging and cloning software

For a more sophisticated alternative to dd that supports backups of the ext4 file system, partclone is easy to use, but again requires text commands instead of a keyboard or mouse interface. Install with:

sudo apt install partclone

And start with:

partclone. (fstype)

… where (fstype) is the filesystem type of the partition you want to clone.

The following command creates a disk image of hda1 (hard disk drive 1, partition 1) named hda1.img:

partclone.ext3 -c -d -s / dev / hda1 -o hda1.img

You may want to restore this image, so use it

partclone.extfs -r -d -s hda1.img -o / dev / hda1

Further details on usage can be found on the partclone website.

4. Clone your Linux drive with Clonezilla

Try Clonezilla for a more flexible solution. This popular disaster recovery solution is based on Partclone and is designed for a range of disk cloning tasks. All expected file systems are supported on Linux, Windows, and MacOS (and beyond).

In contrast to dd and Partclone, Clonezilla is available as a bootable ISO. You can write this to DVD or USB stick to completely clone your Linux hard drive. Clonezilla is straightforward to use, with keyboard menus instead of opaque commands so anyone can use it.

While Clonezilla can be set up as a standalone utility, you may prefer to use it as part of Hiren's Boot CD Recovery Tool.

You can also use Clonezilla professionally to map several similar PC setups with the same operating system.

Download: Clonezilla

Cloning your Linux hard drive is easy

If you've never cloned a hard drive before, you may be a little reluctant. This can be intimidating, especially if you find yourself in dire straits with a damaged hard drive that urgently needs to be cloned before failure.

You may prefer to simply sync your important data to the cloud. However, it is always a good idea to create a full disk backup that you can quickly restore in the event of system failure. However, remember to use these tools with caution as they can easily lead to accidentally losing your data.

Backing up your data is vital! Learn how to optimize your backups on Linux.


VLC Media Player: Every Windows Keyboard Shortcut You Need To Know

VLC Media Player is an excellent open source player. Here you will find all the keyboard shortcuts you need to navigate quickly.

About the author

Christian Cawley
(1420 articles published)

Deputy Editor for Security, Linux, DIY, Programming and Technology explains. He also produces The Really Useful Podcast and has extensive desktop and software support experience.

Christian is an employee of Linux Format Magazine and a Raspberry Pi hobbyist, Lego lover and retro gaming fan.

More from Christian Cawley

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive deals!

One more step …!

Please confirm your email address in the email we just sent you.

. "border =" 0

Leave a Reply

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