Cygwin dd of='\\.\PhysicalDrive0' Invalid argument

0

I'm trying to copy my hard drive. unxutils dd that used to work before, now doesn't.

So I'm trying the Cygwin version. It reads just fine, but can't open for writing:

$ dd if='\\.\PhysicalDrive0' count=0
0+0 records in
0+0 records out
0 bytes (0 B) copied, 4.4131e-05 s, 0.0 kB/s

$ dd if=/dev/null of='\\.\PhysicalDrive0'
dd: opening `\\\\.\\PhysicalDrive0': Invalid argument

basin

Posted 2014-03-01T12:59:56.103

Reputation: 394

Have you tried this native version of dd?

– user1686 – 2014-03-01T15:14:23.243

Windows also writes zeros to a partition when doing a full format. This behavior has been implemented starting with Windows Vista.

– Daniel B – 2014-03-03T07:19:01.237

Answers

1

You may need to use

dd if=/dev/zero of=/dev/sdc

where sdc is whole drive that you want to be zeroed. Check that you are sure that you are zeroing right drive. sdc is the third whole drive, sdc2 is the second partition on the third drive (contains boot sector if it is there). Cygwin uses standard *nix terminology for local drives. You may want to use pv (pipe viewer, it is available in Cygwin) to see the progress:

pv /dev/zero > /dev/sdc

pbies

Posted 2014-03-01T12:59:56.103

Reputation: 1 633

Windows has a /dev/zero and a /dev/sdc ? – Hennes – 2014-03-01T14:37:29.260

1Cygwin on Windows - yes, it has. – pbies – 2014-03-01T15:22:19.397

Cool. I really need to read Cygwin's documentation. – Hennes – 2014-03-01T15:27:06.683

Now if only they ported cfdisk – basin – 2014-03-02T08:14:52.353

2

This works:

dd if=/dev/null of='\\.\PhysicalDrive0' conv=notrunc,nocreat

basin

Posted 2014-03-01T12:59:56.103

Reputation: 394

You're reading from /dev/null, which should do nothing... – Bob – 2014-03-03T06:11:26.027

This opens a file for writing. Enough for a test – basin – 2014-03-03T10:36:42.780