You are currently browsing the archives for November 2019.
Displaying 1 entry.

MacOs: ISO to USB-Stick Perl script

  • Posted on November 3, 2019 at 17:18

Making bootable USB sticks was always easy with MacOs and Balena Etcher. But for some reason this stopped working (for me) with Catalina.

But not to worry! It can now be done with this Perl script I wrote today: iso2usbstick.pl.
Usage is simple. Help message says it all.
And here with syntax highlighting. Just because we can.

$ ./iso2usbstick.pl
You have to be root!
Usage. : # ./iso2usbstick.pl isofile device
Example: # ./iso2usbstick.pl /Users/krusjme/Downloads/kubuntu19.iso /dev/disk2

The script takes care of basically al the hassle that you may run into doing all the command line stuff yourself. It unmounts all possibly mounted volumes on the destination device and it doesn’t nag about existing files. It just overwrites them. On top of that it shows a performance indicator thanks to gdd instead of good old dd.

Here, something like a ‘screen shot’! 🙂

$ sudo ./iso2usbstick.pl CentOS-7-x86_64-NetInstall-1908.iso disk2
Destination disk is given without /dev. Adding it now
Full destination path is: /dev/disk2
Inventorizing possible mounts on destination disk
Unmounting volumes on destination disk
Umounting volume: /dev/disk2s1
Volume TESTVOLUME on disk2s1 unmounted
Making up HDIUtil-command
Converting iso to raw image
Reading Master Boot Record (MBR : 0)…
Reading CentOS 7 x86_64                  (Apple_ISO : 1)…
Reading  (Type EF : 2)…
Reading CentOS 7 x86_64                  (Apple_ISO : 3)…
Elapsed Time:  1.024s
Speed: 539.0Mbytes/sec
Savings: 0.0%
created: /Users/KrusjMe/Desktop/iso2usbstick/CentOS-7-x86_64-NetInstall-1908.dmg
Making up DD-command
DD-command: /opt/local/bin/gdd bs=1M status=progress if=CentOS-7-x86_64-NetInstall-1908.dmg of=/dev/disk2
578551808 bytes (579 MB, 552 MiB) copied, 158 s, 3.7 MB/s
551+1 records in
551+1 records out
578551808 bytes (579 MB, 552 MiB) copied, 158.053 s, 3.7 MB/s 

With thanks to lewan.com for the command line instructions