making usb sticks with GNU Linux and dd: WARNING!

one single wrong drive letter and data could be irreversible destroyed!

(it has happened many times before!!!)

so this script make_stick.sh (download it here) aim’s to double check if it is really the right drive letter:

#!/bin/bash
echo "=== make_stick.sh ==="
echo "copy 1:1 image.iso to (hopefully bootable) usb stick"
echo "(some usb sticks can not boot)"
echo "first parameter: the drive to write to in the format /dev/sdx"
echo "second parameter: the image.iso"

if [ -z "$1" ]
  then
    echo "please pass device like this: /dev/sdx
          TARGET THE WHOLE DEVICE (sdb)
          NOT A PARTITION! (sdb1)"
  else

    echo ""
    echo "please read carefully, a mistake could overwrite critical data"
    echo "physically disconnect all critical data-drives before procedure"
    echo ""
    echo "========== do you want to copy the $2 image on device $1 ?"
    echo ""
    echo "=========== harddisk overview";
    echo "==== where is what";
    lsblk -o 'NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID'
    echo "==== harddisk usage";
    df -Th;
    echo ""
    echo "==== info about this specific harddisk:";
    hdparm -I $1 | grep Model
    echo ""

read -p "Continue (y/n)?" choice
case "$choice" in 
  y|Y ) echo "yes";;
  n|N ) echo "no";;
  * ) echo "invalid";;
esac
    umount $1*;
    dd if=$2 of=$1 status=progress; sync;

    # if the image.iso.gz is compressed, unpack on the fly
    ## multi core
    ### pigz -dc /media/user/EXTERNALHARDDISK/software/iso/IdealLinux/IdealLinux2021.usb.stick.img.gz | pv | dd bs=1M of=$1; # write image to usb stick
    ## single core
    ### gunzip -c /run/media/user/SOFTWARE/LINUX/ideal-linux-stick/ideal-linux-usb_stick_image_full_16GByte_2017-04.img.gz | pv | dd of=$1; # write image to usb stick

    echo "the image $2 was written to stick $1. process finished. try booting it now :)"
fi

graphical gui way?

yes there is such programs now too, which might help avoid mistakes (dd overwriting critical data)

apt show gnome-disk-utility
Package: gnome-disk-utility
Version: 3.30.2-3
Priority: optional
Section: admin
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Installed-Size: 6,660 kB
Depends: udisks2 (>= 2.7.6), dconf-gsettings-backend | gsettings-backend, libatk1.0-0 (>= 1.12.4), libc6 (>= 2.10), libcairo2 (>= 1.2.4), libcanberra-gtk3-0 (>= 0.25), libdvdread4 (>= 4.1.3), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.43.2), libgtk-3-0 (>= 3.21.5), liblzma5 (>= 5.1.1alpha+20120614), libnotify4 (>= 0.7.0), libpango-1.0-0 (>= 1.18.0), libpangocairo-1.0-0 (>= 1.14.0), libpwquality1 (>= 1.1.0), libsecret-1-0 (>= 0.7), libsystemd0 (>= 209), libudisks2-0 (>= 2.7.6)
Breaks: gnome-settings-daemon (<< 3.24)
Homepage: https://wiki.gnome.org/Apps/Disks
Tag: admin::filesystem, hardware::storage, hardware::storage:cd,
 hardware::storage:dvd, implemented-in::c, interface::graphical,
 interface::x11, role::program, uitoolkit::gtk
Download-Size: 967 kB
APT-Sources: https://ftp.halifax.rwth-aachen.de/debian buster/main amd64 Packages
Description: manage and configure disk drives and media
 GNOME Disks is a tool to manage disk drives and media:
 .
  * Format and partition drives.
  * Mount and unmount partitions.
  * Query S.M.A.R.T. attributes.
 .
 It utilizes udisks.
admin