/usr/bin/dd *.iso to USB stick?

Christian Franke Christian.Franke@t-online.de
Sat Sep 23 08:21:02 GMT 2023


Jim Garrison via Cygwin wrote:
> On 9/21/2023 22:40, Martin Wege via Cygwin wrote:
>> Hello,
>>
>> How can I use /usr/bin/dd to copy a *.iso image (Debian netinstall
>> boot image) to a USB stick as raw bytes?
>
> I do this frequently.  You must start the Cygwin shell with admin
> rights, then use Windows Disk Management mmc app to identify
> the disk and convert from Disk n to /dev/sd[x], where Disk 0 is
> /dev/sda, Disk 1 is /dev/sdb, etc.
>
> BIG CAVEAT: You're in admin mode.  Use the wrong device name and you
> will trash target device if it's writable, including your Windows boot
> drive.  And no, the boot drive is not always Disk0 /dev/sda.
>
> I always use hexedit to examine enough of the target device to assure
> myself that it's the correct target.

This is much easier if 'ddrescue --ask' is used instead of 'dd' 
(https://cygwin.com/packages/summary/ddrescue.html). It prints device 
size, identify string and serial "number" string if available and asks 
for confirmation then:

# ddrescue --ask --force image.iso /dev/sde
GNU ddrescue 1.27
About to copy 4671 MBytes
from 'image.iso' (4_562_040Ki)
   to '/dev/sde' [Kingston DataTraveler 3.0::EE03D85142E0] (14_784Mi)
Proceed (y/N)? y
...

Device identity is also printed if the destination is a partition 
(/dev/sde1) on that device. The --force (-f) option is required if the 
destination is not a regular file. Note that for (S)ATA devices, the 
serial may be printed in the unusual LE word string byte order from ATA 
IDENTIFY data. This is a minor bug in some layer behind 
IOCTL_STORAGE_QUERY_PROPERTY.

ddrescue also works with some /proc/sys block devices as source, for 
example /proc/sys/Device/HarddiskVolumeShadowCopy2 or 
/proc/sys/Device/VeraCryptVolumeF  It could also be run from the limited 
WinPE environment, for example to create an image of C: if not booted.

-- 
Regards,
Christian




More information about the Cygwin mailing list