In GNU Linux there are many ways to create disk cloning very powerful applications and tools, but perhaps the most powerful tools for this purpose are dd and Clonezilla, let’s know a little about them with the following quotes:
dd is a program of the family of Unix-level operating systems and a POSIX command, which allows copying and converting data from files to low. It is used to perform advanced operations on devices or files, such as generally:
• Specific data transfers.
• Backup copies of “raw” information (raw data).
• Conversion of some supported encodings and / or predefined characters
Source: Wikipedia.
Clonezilla is a free software for recovering an image created from an operating system, it has various functionalities such as creating an image of the system or deleting it or, for example, deleting a partition. Clonezilla is designed by Steven Shaiu and developed by NCHC Labs in Taiwan. Clonezilla SE (Server Edition) offers multicast support (more than 40 simultaneous computers) similar to Norton Ghost Corporate Edition. Source: Wikipedia.
They are excellent tools that allow disk cloning and creation of disk images of physical units, as such in the case of the “dd” command or “dd” program, which is generally the default in all GNU / Linux distributions and has a manual of use which can be consulted by executing the command:
man dd
In the case of clonezilla, it is not usually due to the GNU / Linux distributions, but it can be installed by executing the command (in the case of debian or distributions based on debian GNU / Linux):
apt-get install clonezilla
Here is an example of disk cloning and disk imaging with the dd command
Before starting, you have to know what hard drives or USB memory are connected to the computer. To do this, we execute the command fdisk -l as superuser. Assuming that the hard disk we want to clone is in / dev / sda and the destination hard disk is in / dev / sdb, to perform the cloning we must execute the following command:
sudo dd bs=1M if=/dev/sda of=/dev/sdb
With the option bs = 1M we are saying that the reading and writing speed are done in blocks of 1 Megabyte. The lower, the slower and the safer. The higher the faster, but we risk not being copied well. To create an ISO image from a CD, run this command:
sudo dd if=/dev/cdrom of=/home/user/idisck.iso
In the case of making an image of a hard disk, it can be done with the following command:
sudo dd if=/dev/sda of=/home/user/idisck.img
To save an ISO on a DVD, the origin and destination would be exchanged:
sudo dd if=/home/user/idisk.iso of=/dev/cdrom
The dd program offers many possibilities when working with hard drives, external memories and CDs or DVDs. I use it a lot and the truth is that it is more comfortable than any other program to burn discs.
In the case of disk cloning with clonezilla we have the following example:
Generate an image of a hard disk on a USB device (External disk).
1. Download the Clonezilla-Live image: http://heanet.dl.sourceforge.net/project/clonezilla/clonezilla_live_stable/clonezilla-live-1.2.2- 31.iso
2. Burn it on a CD.
3. Turn on the computer that has the hard disk to be cloned with the Clonezilla CD inserted in the reader, so that it starts up and not the Operating System that is installed.
4. Choose the screen resolution. Press enter to select the default option “Clonezilla live (Default settings, VGA 1024×768)”
5.- Select the language “Spanish” in the “Choose Language” window.
6. Select “Do not touch the keyboard map” in the window that allows us to choose the keyboard configuration, since we will not use it.
7. Select “start_clonezilla” in the “Start Clonezilla” window. This option allows us to clone the disk graphically.
8. Select the option “device_image Disk / Partition to / from Image” in the “Clonezilla” window to generate an image of the hard disk to be cloned.
9. Select the option “Local_dev Use local device (Ex: hard disk, USB device)” in the “Mount directory” window.
10. Connect the USB device where the hard disk image will be stored. Wait about 5 seconds for the system to recognize it. This step is IMPORTANT, if you press it before it is recognized, you have to start the whole process all over again.
11. Select the USB device that has been connected. Usually it can be distinguished by the name of the USB device.
12. Select the folder where you want to save the image. Leave the default option “/” to save it directly to the USB device.
13. Information about all the devices connected to the computer will now appear on the screen. It is simply informative, so press “Enter” to continue the process.
14. Select the default option “Main Mode Begimen: Accept default options”.
15. Select “savedisk Save_disco_local_as_imagen” in the “Choose mode” window
16. Enter a name for the image, if desired, and press “Enter” to continue.
17. Select the hard drive you want to clone.
18. Now an information window appears with a command that can be saved to use in the future to clone the system in command mode in a faster way, with the configuration options that have been selected. Then press accept to start the process.
19. Now it asks us for confirmation to make the image. You have to press the letter “y” and press “Enter”.
20. Wait for clonezilla to do its job and generate the image. 21.- Finally, press the option “0” and “Enter” to turn off the system and remove the Clonezilla-Live CD and the USB device.
Restoring a hard drive using a cloned image on a USB device:
1. Turn on the computer that has the hard disk to restore with the Clonezilla CD inserted in the reader, so that it starts up and not the Operating System that is installed.
2. Choose the screen resolution. Press enter to select the default option “Clonezilla live (Default settings, VGA 1024×768)”
3. Select the language “Spanish” in the “Choose Language” window.
4. Select “Do not touch the keyboard map” in the window that allows us to choose the keyboard configuration, since we are not going to use it.
5. Select “start_clonezilla” in the “Start Clonezilla” window. This option allows us to clone the disk graphically.
6. Select the option “device_image Disk / Partition to / from Image” in the “Clonezilla” window to generate an image of the hard disk to be cloned.
7. Select the option “Local_dev Use local device (Ex: hard disk, USB device)” in the “Mount directory” window.
8. Connect the USB device that has the image to be restored. Wait about 5 seconds for the system to recognize it. This step is IMPORTANT, if you press it before it is recognized, you have to start the whole process all over again.
9. Select the USB device that has been connected. Usually it can be distinguished by the name of the USB device.
10. Select “/” to show the images on the USB device.
11. Information about all the devices connected to the computer will now appear on the screen. It is simply informative, so press “Enter” to continue the process.
12. Select the default option “Main Mode Begimen: Accept default options”.
13. Select “restoreddisk Restaurar_imagen_a_disco_local” in the “Choose mode” window.
14. Select the image file to restore.
15. Choose the hard disk that you want to restore.
16. An information window now appears with a command that can be saved for future use to restore the system in command mode in a faster way, with the configuration options that have been selected. Then press accept to start the process. It asks for confirmation so you have to press “y” and then “Enter”.
17. Ask again for confirmation. Do the same, press “y” and then “Enter”.
18. The process begins by showing an information window where it is possible to see at all times the time remaining for the restoration to finish.
19. If the restoration process has been carried out correctly, a message will appear indicating press “Enter” to continue. Well, you have to press “Enter”.
20. Finally, press the option “0” and “Enter” which will turn off the system and allow you to extract the Clonezilla-Live CD and the USB device.