Learn Linux DD Command - 15 Examples With All Options
Learn Linux DD Command - 15 Examples With All Options
LINUX HOWTO
LINUX DISTROS
LINUXLINUX
COMMANDS
COMMANDS
The Linux command ‘dd’ is one of the most powerful utility which can be used in a variety of
ways. This tool is mainly used for copying and converting data, hence it stands for ‘data
duplicator’.
• Copy regions of raw device files like backing up MBR (master boot record).
Only superuser can execute this command. You should be very careful while using this
command as improper usage may cause huge data loss. So, some people consider this tool as
‘data destroyer’.
We will learn the various ‘options’ while going through the examples.
Here, ‘if’ stands for input file , ‘of’ stands for output file and ‘bs’ stands for the block size
(number of bytes to be read/write at a time). The conversion parameter ‘noerror’ allows the tool
to continue to copy the data even though it encounter any errors. The sync option allows to use
synchronized I/O.
The above command will copy all the data from the disk /dev/sda to /dev/sdb. ‘dd’ doesn’t know
anything about the filesystem or partitions; it will just copy everything from /dev/sda to /dev/sdb.
So, this will clone the disk with the same data on same partition.
dd if=/dev/sda of=/tmp/sdadisk.img
Backing up a disk to an image will be faster than copying the exact data. Also, disk image make
the restoration much more easier.
dd if=/tmp/sdadisk.img of=/dev/sda
This will synchronize the partition /dev/sda1 to /dev/sdb1. You must verify that the size of
/dev/sdb1 should be larger than /dev/sda1
Master Boot record is the boot sector which houses the GRUB boot loader. If MBR
gets corrupted, we will not be able to boot into Linux. MBR -512 byte data- is located at the first
sector of the hard disk. It consists of 446 byte bootstrap, 64 byte partition table and 2 bytes
signature.
a. Backing up MBR.
dd if=/tmp/mbr.img of=/dev/sda
The option ‘notrunc’ refers to do not truncate the file, only replace the first 512 bytes, if it exists.
Otherwise, you will get a 512 byte file.
Conclusion.
These are the some examples of ‘dd’ command usage. This ‘data duplicator’ command can be
used in a lot more ways in your daily administration tasks.
PREVIOUS ARTICLE
NEXT ARTICLE
Comments (4)
1. Pawan says:
August 26, 2014 at 5:25 pm
Thanks very nice explanation of DD command. I love making files for SWAP with this
command.
Reply
2. HyunWoo Jo says:
March 16, 2015 at 4:23 pm
Reply
Reply
4. Roderick says:
December 23, 2016 at 12:08 pm
Reply
Leave a Reply
Name( required )
Website
Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.
What is linoxide based on ? Windows or Linux ? Type your answer into the box
Submit Comment
Popular Posts
Linux Trends
google.com/+Linoxide
Theo dõi +1
+ 4.892
Linux
Commands
Cheat Sheet...
15 Linux cp
Command
Examples -...
How to install
DD Utility and...
LINUX
COMMANDS
Linux 'make'
Command
Explained...
Can dd
Can dd
Command
Used To Wipe...
rsync
Command to
Exclude a List...
How Linux
Administrator
Monitor High...
Understanding
Each Entry Of
Linux Fstab (...
How To Use
Lsblk To List
Block Device...
How To Fix /
Repair Bad
Blocks In Linux
Subscribe To Free Newsletter
26 JAN, 2017
spam you
Run Command Parallel on Multiple Hosts
using PDSH Tool TAGS
How To Synchronize Directories using
30 AUG, 2016 Syncthing on Ubuntu 16.04
Apache Backup Clustering
24 JAN, 2017
Powerful SSH Command Options with Command Container Docker
25 MAR, 2015
14 JAN, 2015
5 JAN, 2015
28 NOV, 2014
24 NOV, 2014
21 NOV, 2014
19 NOV, 2014
timedatectl - Control Linux System Time and
Date in Systemd
5 NOV, 2014
27 OCT, 2014
6 OCT, 2014
1 OCT, 2014
5 SEP, 2014
29 AUG, 2014
18 AUG, 2014
16 AUG, 2014
15 AUG, 2014
13 AUG, 2014
How to Merge Directory Trees in Linux using cp
Command
23 JUL, 2014
11 JUL, 2014
7 JUL, 2014
23 JUN, 2014
16 JUN, 2014
30 MAY, 2014
2 MAY, 2014
28 APR, 2014
28 MAR, 2014
21 MAR, 2014
What Options you use for Linux killall
Command ? I have 5 Options
14 MAR, 2014
2 MAR, 2014
26 FEB, 2014
24 FEB, 2014
19 FEB, 2014
14 FEB, 2014
10 FEB, 2014
5 FEB, 2014
3 FEB, 2014
27 JAN, 2014
Create Directory - subdirectory, other than that
What mkdir command do in Linux
23 JAN, 2014
14 JAN, 2014
10 JAN, 2014
9 JAN, 2014
1 JAN, 2014
28 DEC, 2013
26 DEC, 2013
22 DEC, 2013
21 DEC, 2013
20 DEC, 2013
Linux vmstat Command - Tool to Report Virtual
Memory Statistics
17 DEC, 2013
14 DEC, 2013
13 DEC, 2013
12 DEC, 2013
10 DEC, 2013
10 DEC, 2013
10 DEC, 2013
8 DEC, 2013
7 DEC, 2013
6 DEC, 2013
Built in Audit Trail Tool - Last Command in
Linux
3 DEC, 2013
1 DEC, 2013
28 NOV, 2013
24 NOV, 2013
23 NOV, 2013
20 NOV, 2013
17 NOV, 2013
6 NOV, 2013
30 SEP, 2013
11 SEP, 2013
2 SEP, 2013
26 AUG, 2013
19 AUG, 2013
12 AUG, 2013
5 AUG, 2013
29 JUL, 2013
22 JUL, 2013
8 JUL, 2013
1 JUL, 2013
24 JUN, 2013
29 MAY, 2013
9 MAY, 2013
5 MAY, 2013
17 APR, 2013
15 APR, 2013
11 APR, 2013
3 APR, 2013
18 MAR, 2013
14 MAR, 2013
1 FEB, 2013
28 JAN, 2013
26 JAN, 2013
10 JAN, 2013
29 DEC, 2012
11 DEC, 2012
8 DEC, 2012
5 DEC, 2012
30 NOV, 2012
28 NOV, 2012
25 NOV, 2012
21 NOV, 2012
10 NOV, 2012
3 NOV, 2012
2 NOV, 2012
20 OCT, 2012
18 OCT, 2012
2 OCT, 2012
12 SEP, 2012
1 SEP, 2012
6 MAY, 2012
What Is Linux RPM And Installing, Uninstalling,
Updating, Querying,Verifying RPM
20 OCT, 2011
7 SEP, 2011
7 SEP, 2011
6 SEP, 2011
6 SEP, 2011
6 SEP, 2011
22 AUG, 2011
22 AUG, 2011
24 JUN, 2011
21 JUN, 2011
18 MAY, 2011
16 MAY, 2011
13 MAY, 2011
10 MAY, 2011
2 MAY, 2011
30 APR, 2011
30 APR, 2011
30 APR, 2011
24 APR, 2011
24 APR, 2011
How To List Linux Pci Devices Using lspci
Command
23 APR, 2011
23 APR, 2011
23 APR, 2011
23 APR, 2011
23 APR, 2011
20 MAR, 2011
20 MAR, 2011
20 MAR, 2011
25 FEB, 2011
25 FEB, 2011