In this digital world we all have some important data stored on our hard disk drive without any backup, may be professional or private. Even though if you are using Linux, the stated ‘Most secure Operating System’, the data present on your hard disk is still not safe. There are many threats to your all files like
- A ransomware scammers might target your PC.
- During Linux installation, a bug can also develop.
- A rare Linux virus might attack.
- Or simply your hard drive will get rupture.
So, whatever may be the reason, it is always better to have entire backup of your hard disk. God forbid, if anything above happens to your PC/laptop and everything stored on your device loses then by restoring the backup, you can get back to your work within minutes with no loss of any data, saving you from guilt and grief of losing your entire life’s work. Hence here are the 4 ways you can follow to backup your whole HDD on Linux operating system.
4 Ways to Back Up Your Entire Hard Drive on Linux
1. dd — The Native Tool For backup
In Linux operating system, dd or “Disk Destroyer” is the most powerful tool because but if we do not handle it carefully, this tool can completely delete the whole storage of your hard drive.
You can find this tool free built-in most Linux operating system, but if not, open package manager and install it. Open terminal window, after opening it, with the help of lsblk command,
Steps to backup:
- Select the terminal which you want to backup.
- Find the name of the drive where the backup will be placed.
Now for backing up the hard drive enter this command and wait
dd if=/dev/sdA of=/dev/sdB bs=64K conv=noerror,sync
Where sdA is the disc you want to backup and sdB is the address of the drive where the system will hold the backup.
The bs in the above line stands for block size, which means the size of the data block by which transfer of data takes place. 512 bytes is the default value. Since this value is very small, it is better to write 64 K or 128 K as the condition. Bigger value helps in transferring data at a higher rate while smaller value of bs gives more accurate data.
For cloning a particular part of your hard disc drive, use the following command.
dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync
Image source: Google
Here sda1 the part of the hard drive sda which will be copied to a new partition sdb1 of an external or secondary hard drive sdb present on your computer. Now run the command. Wait until the backup is complete.
The shortest way to backup your entire hard drive on Linux is with the help of TAR. It does not make a copy or image of the whole drive rather it compresses the ditto copy of whole filesystem of Linux operating system into TAR archive. To do the entire backup of disk drive, follow the steps:
- After opening terminal, enter “cd /”. This command is used for putting the user in the / directory or root where we can find all files on our Linux installation.
- Now just enter the following command for backup and run it -”sudo tar -cvpzf backup.tar.gz –exclude=/backup.tar.gz –one-file-system /”.
- So when the command is finished running, we just need to search inside the / folder,a file named backup. tar.gz .
- Finally move this file to an external hard drive for keeping it safe.
3. Gnome Disk Utility
Of all the methods to backup hard disc drive on Linux, this is the most user friendly way because in this method one don’t have to deal with command line programs, live disks or anything like that. Gnome disc utility is a tool that is available with most distributions of Linux. Or if you are already using Gnome, there is high chance that this tool is already present in your PC. But if that’s not the case you can always install it by searching ‘gnome-disk-utility’ under Linux distribution package manager.
It is very basic and self explanatory. It basically creates the copy of the hard disc which the user select to backup and save in the form of raw .IMG file. Now, before you start backing up there is one thing that should be kept in mind that there must be enough space to store the backup files in the hard drive. Because if the drive is, say 750GB big, then the image file of the disc would also be 750 GB .IMG file. And if the drives largest capacity is 1TB then clearly it can store 1.5 TB. So either connect one external hard drive or create the image of the storage of hard disc drive of the computer is less than half of the maximum storage. Now follow the steps to backup.
- Open the Gnome disc utility program.
- After opening it, to choose the hard drive if you want to backup.
- Now click the “create disc image” option in the menu.
- The program will demand for the password. Enter the password.
- Save the backup and give some name to your .IMG file.
- Now just wait for the backup to complete.
4. Clonezilla — Partition Imaging And Cloning Software
An another popular way that can help you in backup your hard drive on Linux is Clonezilla.It is basically a live CD or disc utility program that can be booted from a USB drive. It is a more advanced tool damn Gnome disc. Although both of the programs have similar features but clonezilla comes with more options and setting for advanced users. Some of the advantages of Clonezilla over Gnome disk utility are following.
- It support wide variety of file system.
- Also it can copy entire HDD or even partitions of it.
- It can work smartly by backing up only the parts of drive which are actively in use by cloning them.
- Clonezilla can clone to .IMG file or from one drive to another.
Here is the method of using clonezilla for running disc to disc copy.
First of all, you have to download clonezilla. There are many choices of ISO files present. Of all this, I would prefer stable because
- Testing and stable both uses debian and has only open source software while Ubuntu operating system and some non open source software is used by alternate.
- Now, choosing between stable and testing, so we would prefer stable because we can be handy while using stable compared to testing.
Preparing to Clone
From the CD, after booting the ISO file, the clonezilla application will start.
- Choose language and keymap.
- Then a dialogue box will appear asking you to start the cloning process or drop to shell. The shell option is a confusing one and this must not be understated. The shell option is used for partitioning before backing up. After doing this the application can be restarted by sudo /opt/drbl/sbin/clonezilla
- Choose the type of disc transfer. It can be
- local to local disc.
- disk to remove disk.
- part to local part.
- part to remote part.
- Choose the source of the drive to backup and destination where the backup will be stored.
- Now transfer will begin.
- After transfer is completed save the clone file with a suitable name.
These were the most popular four methods to back up hard drive disk in Linux operating system. Hope this helps.