public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* /usr/bin/dd *.iso to USB stick?
@ 2023-09-22  5:40 Martin Wege
  2023-09-22 23:10 ` Jim Garrison
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wege @ 2023-09-22  5:40 UTC (permalink / raw)
  To: cygwin

Hello,

How can I use /usr/bin/dd to copy a *.iso image (Debian netinstall
boot image) to a USB stick as raw bytes?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: /usr/bin/dd *.iso to USB stick?
  2023-09-22  5:40 /usr/bin/dd *.iso to USB stick? Martin Wege
@ 2023-09-22 23:10 ` Jim Garrison
  2023-09-23  8:21   ` Christian Franke
  2023-09-25 14:05   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  0 siblings, 2 replies; 4+ messages in thread
From: Jim Garrison @ 2023-09-22 23:10 UTC (permalink / raw)
  To: cygwin

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.

-- 
Jim Garrison
jhg@acm.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: /usr/bin/dd *.iso to USB stick?
  2023-09-22 23:10 ` Jim Garrison
@ 2023-09-23  8:21   ` Christian Franke
  2023-09-25 14:05   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Franke @ 2023-09-23  8:21 UTC (permalink / raw)
  To: cygwin

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXTERNAL] Re: /usr/bin/dd *.iso to USB stick?
  2023-09-22 23:10 ` Jim Garrison
  2023-09-23  8:21   ` Christian Franke
@ 2023-09-25 14:05   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  1 sibling, 0 replies; 4+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2023-09-25 14:05 UTC (permalink / raw)
  To: jhg, cygwin; +Cc: Jim Garrison

> 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.

A much easier (and safer!) way to do that is to

$ cat /proc/partitions

-- it'll tell you exactly which /dev/sdX to use for the physical drives, not guesswork required.

HTH,

Anton Lavrentiev
Contractor NIH/NLM/NCBI


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-25 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22  5:40 /usr/bin/dd *.iso to USB stick? Martin Wege
2023-09-22 23:10 ` Jim Garrison
2023-09-23  8:21   ` Christian Franke
2023-09-25 14:05   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).