dd is a common Unix program whose primary purpose is the low-level copying and conversion of raw data. dd is an application that will “convert and copy a file”according to the referenced manual page for Version 7 Unix and is most likely inspired from DD found in IBM JCL, and the command’s syntax is meant to be reminiscent of this.
Learn how to use DD by visiting this site Here
Hope you enjoy
1) Duplicate several drives concurrently
dd if=/dev/sda | tee >(dd of=/dev/sdb) | dd of=/dev/sdc
If you have some drive imaging to do, you can boot into any liveCD and use a commodity machine. The drives will be written in parallel.
To improve efficiency, specify a larger block size in dd:
dd if=/dev/sda bs=64k | tee >(dd of=/dev/sdb bs=64k) | dd of=/dev/sdc bs=64k
To image more drives , insert them as additional arguments to tee:
dd if=/dev/sda | tee >(dd of=/dev/sdb) >(dd of=/dev/sdc) >(dd of=/dev/sdd) | dd of=/dev/sde
2) create an emergency swapfile when the existing swap space is getting tight
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000;sudo mkswap /swapfile; sudo swapon /swapfile
Create a temporary file that acts as swap space. In this example it’s a 1GB file at the root of the file system. This additional capacity is added to the existing swap space.
3) Backup your hard drive with dd
sudo dd if=/dev/sda of=/media/disk/backup/sda.backup
This will create an exact duplicate image of your hard drive that you can then restore by simply reversing the “if” & “of” locations.
sudo dd if=/media/disk/backup/sda.backup of=/dev/sda
Alternatively, you can use an SSH connection to do your backups:
dd if=/dev/sda | ssh user@ssh.server.com dd of=~/backup/sda.backup
4) Convert a Nero Image File to ISO
dd bs=1k if=image.nrg of=image.iso skip=300
This line removes the 300k header from a Nero image file converting it to ISO format
5) send DD a signal to print its progress
while :;do killall -USR1 dd;sleep 1;done
every 1sec sends DD the USR1 signal which causes DD to print its progress.
6) show dd progress part 2
killall -USR1 dd
if you need see progress of long dd command, enter subj on other console
7) How to copy CD/DVD into hard disk (.iso)
dd if=/dev/cdrom of=whatever.iso
A dear friend of mine asked me how do I copy a DVD to your hard drive? If you want to make a copy of the ISO image that was burned to a CD or DVD, insert that medium into your CD/DVD drive and (assuming /dev/cdrom is associated with your computer?s CD drive) type the following command
8) Watch the progress of ‘dd’
dd if=/dev/zero | pv | dd of=/dev/null
need pv (pipe view) :
http://www.ivarch.com/programs/pv.shtml
9) Clone IDE Hard Disk
sudo dd if=/dev/hda1 of=/dev/hdb2
This command clone the first partition of the primary master IDE drive to the second partition
of the primary slave IDE drive (!!! back up all data before trying anything like this !!!)
10) Test network speed without wasting disk
dd if=/dev/zero bs=4096 count=1048576 | ssh user@host.tld 'cat > /dev/null'
The above command will send 4GB of data from one host to the next over the network, without consuming any unnecessary disk on either the client nor the host. This is a quick and dirty way to benchmark network speed without wasting any time or disk space.
Of course, change the byte size and count as necessary.
This command also doesn’t rely on any extra 3rd party utilities, as dd, ssh, cat, /dev/zero and /dev/null are installed on all major Unix-like operating systems.
11) clone a hard drive to a remote directory via ssh tunnel, and compressing the image
dd if=/dev/sda | gzip -c | ssh user@ip 'dd of=/mnt/backups/sda.dd'
Pingback: Tweets that mention 11 Awesome DD Commands -- Topsy.com
Jackie
Pingback: 几条实用的 Linux Shell 命令 [技巧] | Wow!Ubuntu
Pingback: Quickies: useful dd commands « 0ddn1x: tricks with *nix