85

I need to read and write various flash card images. The way i always did this in linux was with dd, and that did the trick. What is a good windows equivalent?

Simply put, i need to be able to read an entire card into a file and vice versa. I tried WinDD, but that seems to operate on partitions rather than entire devices, but i need to be able to dump the entire disk/card and its partition table regardless of its content.

Using Windows 7 64bit, with the card reader on a USB3 port.

Jarmund
  • 6,277
  • 5
  • 38
  • 60

15 Answers15

35

Just use dd for WIndows ... it works perfectly even though it is quite an old project.

Eugen Rieck
  • 20,637
28

Rufus works as expected. Choose 'DD Image' for 'Create bootable disk using'.

The source is published on GitHub: https://github.com/pbatard/rufus.

balenaEtcher is another Windows compatible tool for writing writing images to USB drives. It's also fast, and is easier to use than Rufus.

My experience: Win32DiskImager did not detect u-SD through a USB-3 reader; dd for Windows, MinGW compiled dd, Unix Utils dd, and Linux dd VIA VirtualBox VM USB3 pass-through were all unacceptably slow; I have yet to find a Windows command line equivalent that can beat the 50MB/s write speeds I'm seeing with Rufus.

26

Try Win32DiskImager , it can write images to disks.

19

First I also tried Win32DiskImager, which I thought is doing only partition copy based on its display (no, it can backup an entire SD card), so I continued searching.

My current favourite is HDDRawCopy. It copies to/from file an entire disk image, but not partitions separately. It creates dd compatible or compressed images on the fly - not as efficient as 7zip (does not reach ZIP performance even) but you don't need to touch the image again.

Andris
  • 291
15

surprised nobody mentioned GNU core utils for Windows, I've been using them for years. they're 32-bit binaries but apparently, except for less, they still work under Windows 7 64-bits.

example usage:

C:\Windows\Temp>dd if="\\.\s:" of=sdrive.dat bs=4096
25599+0 records in
25599+0 records out
104853504 bytes (105 MB) copied, 30.3147 seconds, -56145186608800624000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000 MB/s

C:\Windows\Temp>dd if="\\.\physicaldrive0" of=mbr.dat bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0210012 seconds, -891479495977528 kB/s

the reported times are a bit odd but otherwise it seems to work well.

jcomeau_ictx
  • 859
  • 10
  • 15
12

For a true equivalent of dd on Windows, don't look for half-baked alternatives — just install the real GNU dd. The best ways to do this are probably Cygwin and Msys2, pretty complete distributions of GNU and other FOSS tools. Think of it as installing "Linux" on top of Windows, without any emulation layers or a limited black box like the Windows Subsystem for Linux. It's as native as it gets.

In order to use either one of them, you'll need to:

  1. Install a basic environment. Do so as instructed either for Cygwin or for Msys2, just leave the defaults if you only need dd — but you can also have some fun and get a hint on what it has to offer.
  2. Open the respective terminal as administrator, then check which device/partition you want to work on with cat /proc/partitions.
  3. Use dd as you would on any Linux.
Xerz
  • 244
8

I was just trying to verify a drive was wiped, so all I cared about was reading, but this python script could be modified to do anything like this if you don't trust those executables like I didn't. Open Windows Partition Manager to get what the drive number of drive you care about is, and just change that 2 to that number. You can then write that out, or if you did wb instead of rb you could write. Good luck

import sys

f = open('\\\\.\\PhysicalDrive2','rb')
a = f.read(1)
i = 1

kb = 1024
mb = kb*1024

while a == b'\x00':
    i+=1
    if i % mb == 0:
        sys.stdout.write('\r{} MB scanned'.format(i/mb))
    a = f.read(1)

print('done')
phuclv
  • 30,396
  • 15
  • 136
  • 260
5

BusyBox for Windows(32bit and 64bit versions) contains dd with support of /dev/zero and /dev/urandom

Examples:

C:\>busybox dd if=\\.\physicaldrive0 of=mbr.bin bs=512 count=1
1+0 records in
1+0 records out

C:>busybox dd if=\.\G: of=disk.img 2006465+0 records in 2006465+0 records out

Help: busybox dd --help

fau
  • 71
5

If you have git installed for windows (tortoiseGit), it ships with Git Bash.

Git bash has dd built-in, and you can access phyical drivers directly using "physicalDrive".

An example that reads the full card contents into a file (You need admin permissions and need to know the physicalDrive index -- assuming 3 there):

dd if='\\.\PhysicalDrive3' of=/c/Temp/file.bin

An example that reads a bin file, and writes it after 1000bytes into phyicaldrive33.

dd if=/c/Temp/someDummyFile.bin bs=1 seek=1000 of='\\.\PhysicalDrive33' conv=notrunc,nocreat

Another useful tool is HxD. It allows you to graphically open physical drivers too and inspect/edit them on the fly.

Arnout
  • 361
5

Just installed Git Bash on Windows 10 (download it here) and could generate a file with 128KB of random generated data with dd, without a problem.

dd if=/dev/urandom bs=1024 count=128 of=myfile
4

wow all those responses and DISM has been around for how long? pretty sure it was built into windows 7 from the get go.

DISM /capture-image /image-file:d:\backup.wim /capturedir:c:\ /name:simpleback

there are alot of settings you can tweak. after you capture - deploy to new storage media using the dism tools also.

gronostaj
  • 58,482
4

Git for Windows has all Linux coreutils along with the dd which worked fine for me on the recent Windows 10 versions:

http://git-scm.com/download/win

It has portable zip variant also, so you can just unpack it into your WinPE bootable USB stick and have all the power of Unix/Linux tools on it. (I created my WinPE stick with the free version of Paragon Backup & Recovery. It has cmd shell from which you can start as many git-bash windows as you wish.)

Andriy
  • 61
3

After trying some of the tools recommended here, I ended up using balena Etcher on Windows 10. (Rufus gave me a result with an incorrect checksum. HDDRawCopy gave me a write error.)

fuzzyTew
  • 149
2

rawcopy from http://www.ltr-data.se/opencode.html/. rawcopy -h shows manual.

If you need /dev/zero and /dev/random, there is "Zero and Random device driver" from the same site.

fau
  • 71
2

Available for download is dd; is a common program with the primary purpose of low-level copying of raw data. Once installed, open the command prompt and type (substitute the correct path):

Updated file at: http://www.chrysocome.net/downloads/dd-0.5.zip

Usage: http://www.chrysocome.net/dd

dd.exe if=/path/to/the/downloaded/iso of=/path/to/the/USB/device
Zimba
  • 1,291