January 22, 2013

How to dd dd dd do dd in cygwin

 technikl
By technikel

DISCLAIMER: This entry is for my own use and can result in wiping of disk drives if done improperly. I accept no responsibility or liability for what you do to your stuff, use at your own risk. As with anything use your own judgement as to what is safe for your computer, your situation, and your level of expertise.
1. In order copy a flash drive to an image on the local drive do the following:
  • Make a mount point for the usb stick in the /dev directory of cygwin at a bash terminal. Use “mkdir /dev/usbdrive” for example
  • Go to computer, right click::”manage”, then disk manager and locate the physical drive number of the usb drive. In this case the drive was found at physical drive 3.
  • Mount the usb drive with a command like this “mount //./physicaldrive3 /dev/usbdrive”
  • Use dd to copy the image eg.: “dd if=/dev/usbdrive of=/tmp/usbdrive.img bs=1M”
2. In order to copy this to a new drive do the following:
  • Find the partition name with “cat /proc/partitions”
major minor #blocks name
8 0 29309015 sda8 1 102400 sda1
8 2 29205592 sda2
8 16 976762584 sdb
8 17 976759808 sdb1
8 32 732574583 sdc
8 33 732572032 sdc1
8 48 3906560 sdd
8 49 3906528 sdd1
  • In this case I was looking for a 4 GB partition for my 4 GB USB drive, so /dev/sdd is the interesting device. Don’t use sdd1 as that is the partition, and what you want to write to is /dev/sdd the DEVICE
  • So the right command to copy the image to the flash drive is “dd if=/tmp/usbdrive.img of=/dev/sdd bs=1M”
That should be all!
©