The dd (data duplication) utility is a powerful command-line tool that allows copying and converting data between different sources and destinations. It is widely used in Linux and is an indispensable tool for working with disks and disk images.
Here are a few examples of using the dd utility.
Copying the contents of a disk to an image
dd if=/dev/sda of=/home/user/image.img
In this example, the dd utility copies the contents of the /dev/sda disk to the /home/user/image.img file. This file will contain a complete disk image, including the file system and data.
Creating a bootable USB drive
dd if=/path/to/iso/file.iso of=/dev/sdb bs=4M status=progress
This example demonstrates how to create a bootable USB drive from an ISO disk image. The dd utility writes the contents of the ISO file to the /dev/sdb drive, using a block size of 4M and displaying the operation progress.
Writing an image to a disk
dd if=/home/user/image.img of=/dev/sda
In this example, the dd utility writes the contents of the /home/user/image.img image to the /dev/sda disk. This can be useful if you want to quickly restore a disk from an image or copy the contents of a disk to another disk.
Erasing data from a disk
dd if=/dev/urandom of=/dev/sda bs=4M status=progress
In this example, the dd utility writes random data from /dev/urandom to the /dev/sda disk. This can be useful if you want to completely erase the data from the disk before disposing or selling it.
The dd utility is a powerful command-line tool that can be used to copy, convert and delete data from various sources and destinations. It is often used in Linux systems to work with disks and disk images. If you often work with disks and disk images, the dd utility will be an indispensable tool in your arsenal.