« 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 | 6 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.
November 9th, 2024 at 08:18
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
November 22nd, 2024 at 07:52
… [Trackback]
[…] Find More on on that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
December 1st, 2024 at 20:29
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]
December 7th, 2024 at 06:15
… [Trackback]
[…] Read More Info here to that Topic: compdigitec.com/labs/2008/08/14/how-to-use-dd-to-copy-move-and-erase-disks/ […]