7

I'm having problem to use this command under windows

dd if=*file* of=/dev/sdx bs=512 seek=2 conv=fsync 

Using cygwin shell:

$ dd if=file of=/cygdrive/f bs=512 seek=2 conv=fsync

dd: failed to open ‘/cygdrive/f’: Is a directory

F: is the letter where my SD Card is mapped. What's the way to access it?

Zoe
  • 27,060
  • 21
  • 118
  • 148
user3428154
  • 1,174
  • 5
  • 18
  • 38

2 Answers2

9

As you wrote dd if=file of=/dev/sdx so you need to identify the device name sdx equivalent for your disk F:

On my system:

$ cat /proc/partitions
major minor  #blocks  name   win-mounts

    8     0  175825944 sda
    8     1  175824896 sda1   C:\
    8    16 1953514582 sdb
    8    17 1953512448 sdb1   E:\

so /dev/sdb is the full USB hardisk and /dev/sdb1 is the first partition.
Pay attention to what you are doing. dd is a dangerous tool and can destroy your data/system

Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
matzeri
  • 8,062
  • 2
  • 15
  • 16
4

I never did find a good way to explicitly map a windows drive to a Cygwin drive but I did find a great alternate way to solve the problem/use dd on a windows machine.

dd is actually part of the package installed/shipped with Git for Windows. Once that is installed/unzipped if using the portable version you can find the binary in C:\Program Files\Git\usr\bin\dd.exe

The hardware mapping equivalent for if/of setting is written in the notation \.\DEVICENAME0 and can be found by running this PowerShell command (as-written also returns sector size)

Get-WmiObject Win32_diskdrive | select Caption,DeviceID,BytesPerSector,InterfaceType,Size
Chirishman
  • 327
  • 4
  • 6
  • 1
    love this pointer (side note, I used "wmic diskdrive list brief" to list my drives), but I get an error about my destination drive being a directory when running as admin PS C:\Program Files\Git\usr\bin> .\dd if=\\.\PHYSICALDRIVE1 of=\\.\PHYSICALDRIVE2 bs=512 (error = "/usr/bin/dd: failed to open '\\.\PHYSICALDRIVE2': Is a directory") – S Hunter Simpson May 10 '22 at 20:12