"dd" - Copy Data from/to Storage Devices

This section 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

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

File Systems

 "df" - Display Free Space of File System

 Mount USB Drive as File System

"dd" - Copy Data from/to Storage Devices

 Use "dd" Command to Test I/O Speed

 "du" - Display Disk Usage of Directories

 Mount Windows NTFS File System

 Access Persmissions on "ntfs-3g" File System

 Mount Windows Shared Folders

 W95 Ext'd (LBA) Partition

 Reformat NTFS Partition into EXT4 Partition

 NFS (Network File System)

 Mount NFS (Network File System) on macOS

 /etc/mtab and /etc/fstab Files

 Unreachable Remote File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB