« Parsing text files in PHP with FlatfileTools | Home | Embeder – a free PHP to EXE solution »
How to use dd to copy, move and erase disks
By admin | August 14, 2008
Often, you may encounter the need to move a partition, copy a partition or copy a CD/DVD. The easiest and most user-friendly way to do this is with GParted. However, in a server environment or a command line environment where the GUI is not available, GNU dd is an good way to perform these simple tasks. Here are easy tips on how to use dd for disk manipulation. Most of these commands require you to be part of the “disk” group.
If you are on the Windows platform, you will need a copy of rawwrite dd for Windows in your %PATH%. To list the disks with rawwrite dd, use dd –list and use the devices listed there; for example, use “\\?\Device\HarddiskVolume1” instead of “/dev/sda1”. For CD drives, replace /dev/cdrom with “\\?\Device\CdRom0”.
- dd if=/dev/partition of=/dev/destination – Copy the partition partition to the partition destination.
- dd if=/dev/cdrom of=filename.iso – Make an ISO image of the disc in your CD drive as filename.iso. Then you can use in Virtual Machines such as VMWare, mount it in Windows with DaemonTools or mount it as an file system in Linux.
- dd something bs=speed – Performs the action something at the speed of speed bytes per second. Can be used to copy CDs and disks faster.
- dd if=/dev/zero of=/dev/pdest – Wipes the filesystem from the partition pdest, which can you can then make a new filesystem with mkfs.ext3 /dev/pdest.
- dd if=/dev/part of=filename.disk – Makes a intact backup of everything on the partition part into the file filename.disk.
- dd if=filename.disk of=/dev/part – Copies from intact backup filename.disk into the partition part. Make sure that the partition part is big enough to hold filename.disk.
- dd if=/dev/cdrom of=/dev/part bs=10M – Copies the CD filesystem on your CD to the partition part.
- dd if=/dev/fd0 of=filename.img – Copies the floppy in your floppy drive to filename.img. Then the image can be used in Virtual Machines.
- dd if=filename.img of=/dev/fd0 – Copies the image filename.img to the floppy in your floppy drive.
- dd if=/dev/disk of=bootsect.bin bs=512 count=1 – Copies the boot sector of disk disk to the file bootsect.bin.
- dd if=/dev/disk of=/dev/null – The best way to waste your CPU power; copies disk to NULL.
So as you can see, dd is a very useful tool to manipulate partitions and images. If you found this article interesting or helpful, please help us spread the word or please leave a comment!
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Linux, Windows | 10 Comments »
May 16th, 2009 at 04:06
Umm,
bs doesn’t have anything to do with ‘byte speed’, it is simply ‘bytes’:
bs=BYTES
read and write BYTES bytes at a time (also see ibs=,obs=)
August 18th, 2009 at 04:36
Thank you. I found this page very useful, including the comment by Mr. Rankin.
July 21st, 2024 at 19:19
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
August 23rd, 2024 at 22:28
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
August 26th, 2024 at 20:19
… [Trackback]
[…] Find More Info here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
September 10th, 2024 at 00:27
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
September 11th, 2024 at 18:53
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
September 22nd, 2024 at 17:13
… [Trackback]
[…] Read More Information here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
September 24th, 2024 at 22:18
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
October 5th, 2024 at 07:44
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]