INFORMATICS

The Best

How to Make Disk Images in Linux with DD Command

Inicio desactivadoInicio desactivadoInicio desactivadoInicio desactivadoInicio desactivado
 

How to Make Disk Images in Linux with DD Command

Install LSSCSI Utility

Open the command-line terminal.

Make sure to have the “lsscsi” utility installed on your system. If it is not installed, try to install it using the below “apt” command followed by the keyword “install” and “lsscsi”.

sudo apt install lsscsi

After installing the “lsscsi” utility, now it’s time to use it for listing all the storage devices of our Linux system. 

lsscsi

Check Disk Information

sudo fdisk /dev/sda

Create a Clone Disk Image

Now you have almost every piece of information regarding the “/dev/sda” drive.  Press “q” to exit the commanding theme. Now, you are ready to make a disk image using the DD command.

sudo dd if=/dev/sda1 of=/tmp/sda.img bs=1k conv=noerror

Let’s check the destination image file to see if all the data from the source drive has been cloned into it properly or not. Use the below list command along with the path of an image file of the drive as:

ls –lh /tmp/sda1.img

The output shows the rights assigned to this image file, its size, and location. You can say that it has similar rights and size as the original disk drive have.

To see some more information regarding the disk image file, you have to try the below “fdisk” command followed by the flag “-l” as below.

fdisk –l /tmp/sda1.img

Restore the Drive from Clone Image

Now, if you want to restore your original disk drive along with all the data it has, you have to use the DD command again to do so.

sudo dd if=/tmp/sda1.img of=/dev/sda1 bs=1k conv=noerror

Search