Cannot make a image file using `dd` command under Windows
You shouldn't use DOS syntax directories with dd!! The directory syntax is like with linux. Where did you even get the idea of using such a syntax! Try at least trying to follow a guide of some sort!
This command worked for me for example. (Done from an administrative cmd prompt), and you can change -b 1M
to -b 4M
(you have 4M, perhaps the latter is faster, but I found 1M fine)
(ok i'm using ddrescue (a gnu package, and is actually better than dd), but the way i've specified the partition, in contrast to how you have, applies to dd too)
$ ddrescue -r3 -b 1M -d /dev/sdb /cygdrive/c/crp/fsfwr_.fc
Cygwin is more awkward than linux when it comes to showing what is mounted where
You can look at /dev and do things like $ cygpath -w sdb1
and it might say e.g.
\\.\F:
And this crazy command a linux wiz showed me for use in cygwin, automates the cygpath -w commands, and can give you a list of what is moutned where
for F in $(gawk '{if (FNR > 2) print "/dev/" $4;}' /proc/partitions) ; do echo "$F $(cygpath -w $F)" ; done
it then shows like
/dev/sda \\.\PhysicalDrive0
/dev/sda1 \\.\Volume{b6ef2ec3-451e-11e2-822b-806e6f6e6963}
/dev/sda2 \\.\C:
/dev/sdb \\.\PhysicalDrive1
/dev/sdb1 \\.\F:
/dev/sdc \\.\PhysicalDrive2
/dev/sdc1 \\.\G:
/dev/sdc2 \\.\Volume{b6ef2ec3-451e-11e2-822b-806e6f6e6963}5
so the syntax for your dd line would be like this below, though might not be sdb1, but you can run that command above to see which /dev to use.
dd if=/dev/sdb1 of=/cygdrive/k/backup_sd_card.img bs=4M
lluke
Updated on September 18, 2022Comments
-
lluke over 1 year
I am trying to copy sd card using
dd
command under Windows cygwin, and I am getting following error:>>> dd if=i:\ of=k:\backup_sd_card.img bs=4M dd: error reading 'i:\': Is a directory 0+0 records in 0+0 records out 0 bytes copied, 0.00629135 s, 0.0 kB/s
or I try also:
>>> dd if=\\?\Volume{ab627f51-f12b-11e7-bc1b-e277073b2b9d}\ of=k:\backup_sd_card.img bs=1M dd: failed to open '\?Volumeab627f51-f12b-11e7-bc1b-e277073b2b9d\': No such file or directory
drive sygnature is taken from
mountvol
command.dd version I am using:
>>> dd --version dd (coreutils) 8.26 Packaged by Cygwin (8.26-2)
How to make copy and revert using
dd
such a image?-
QuickishFM over 5 years
dd
is used to copy disks by their disk identifier, NOT their mounted folders. The problem with using folders is that the folder represents the data of the disk in a certain format - this can be different based on the filesystem, and doesn't encompass all of the data, for e.g. file indeces. When dd copies a disk, it copies the exact sectors bit-for-bit, regardless of the folders/file structure or filesystem. You need to find how the disks are seen inside cygwin. You may not be able to access the disk as a device (as you would in Linux under /dev/sdXX) if its being handled by Windows. -
barlop over 5 yearsouch. you shouldn't be using DOS syntax directories with dd!! The directory syntax is like with linux. Where did you even get the idea of using such a syntax! Try at least trying to follow a guide of some sort!
-
lluke over 5 yearsTo be clear I am using conemu terminal but binary 'dd' if from cygwin. I am using syntax like at this article realinfosec.com/?tag=how-to-use-dd-on-windows . Disk is seen by mountvol as \?Volumeab627f51-f12b-11e7-bc1b-e277073b2b9d\ . Do I still need to search disk signatures under cygwin?
-
-
Tonny over 5 yearsThat is the way to do it. Use proper Linux syntax for the device-names and use "run as administrator". You may also have to go into Windows DiskAdministrator and remove the drive-letter from the SD-card first. If it has a drive-letter the virusscanner and/or Indexing Services (and probably some other background stuff) may keep it locked when DD is trying to get exclusive access to the card.
-
lluke over 5 yearsTo be clear I am using conemu terminal but binary 'dd' if from cygwin. I am using syntax like at this article realinfosec.com/?tag=how-to-use-dd-on-windows . Disk is seen by mountvol as \?Volumeab627f51-f12b-11e7-bc1b-e277073b2b9d\ . Do I still need to search disk signatures under cygwin?
-
barlop over 5 years@lluke I haven't tested using that volume windows syntax with cygwin(which is pretty ugly anyway!), but it makes more sense to use the linux style /dev/ syntax to specify the partition and looks neater too
-
G-Man Says 'Reinstate Monica' about 4 yearsYou seem to be confused about what
if
andof
mean. The user has not been tellingdd
to write an image to the root directory of the drive; they are trying to copy the drive to an image file. And, if the user says that their SD card appears as driveI:
, why in the world would you suggestof=C:
? (Hint: Don’t try that at home; if it does anything, it’s probably destructive.)