Linux Tutorials - Herong's Tutorial Examples - v1.32, by Dr. Herong Yang
"dd" - Copy Data from/to Storage Devices
Provides a tutorial example on how to copy continuous blocks of data bytes from or to storage devices using the 'dd' command. File system structures can be bypassed.
If you want to copy data as continuous blocks of bytes from one device to another, you can use the "dd (data duplicator)" command as shown in this tutorial. If device names are used in "dd" commands, file system structures are not respected.
1. Copy data from a raw device. This will read data continuously from the device without respecting the partition and format structures.
(copy the first block (512 bytes) from a USB drive) herong$ sudo dd count=1 if=/dev/sdb of=one-block 1+0 records in 1+0 records out 512 bytes copied, 6.1976e-05 s, 8.3 MB/s
2. Copy data to a raw device. This will write data continuously to the device and whipping out the partition and format structures. This command is very dangerous. One typo in the device name could damage the MBR (Master Boot Record) of the hard disk, which is represented as /dev/sda.
(copy CentOS 8 DVD image to a USB drive) herong$ sudo dd if=CentOS-8.1.1911-x86_64-boot.iso of=/dev/sdb (copy a backup file in TAR (Tape ARchiving) format to a tape device ) herong$ sudo dd if=backup.tar of=/dev/sdc (copy 1 GB of '0' to the beginning of a tape device) (this is a good way to remove sensitive data on old tapes) herong$ sudo dd if=/dev/zero of=/dev/sdc bs=64k count=16k
Table of Contents