Hero Image

USB disk with Linux

Create bootable Debian installations USB

On Linux, you can use the command line tool dd for a bit-for-bit copy. First, identify your USB device (e.g., /dev/sdX) using lsblk or sudo fdisk -l, and ensure it is unmounted. Then, execute the command:

sudo dd if=path/to/debian.iso of=/dev/sdX bs=4M status=progress oflag=sync

ext4

lsblk

Unmount it (replace sdb with your device)

sudo umount /dev/sdX1

Create a GPT partition table

sudo parted /dev/sdX --script -- mklabel gpt

Create a single ext4 partition spanning the whole disk

sudo parted /dev/sdX --script -- mkpart primary ext4 0% 100%

Format as ext4 (-F forces, -L sets a label)

sudo mkfs.ext4 -F -L "MyUSB" /dev/sdX1

Verify

sudo parted /dev/sdb --script -- print
lsblk -f

A few notes:

  • GPT is preferred over MBR here since ext4 is Linux-only and GPT handles larger disks better. MBR works fine for sticks under 2 TB though.
  • The -F flag on mkfs.ext4 forces creation even if the device looks like a whole disk (no partition table) — useful if you skip step 3–4 and format the raw device directly.
  • Ownership: after formatting, the root directory is owned by root. If you'll mount it as a regular user, fix it with:
sudo chown $USER /dev/sdb1  # won't work; do this after mounting
sudo mount /dev/sdb1 /mnt/usb
sudo chown $USER /mnt/usb

Mount when you want to use it:

sudo mkdir -p /mnt/usb
sudo mount /dev/sdb1 /mnt/usb

exFAT

# 1. Identify the device
lsblk

# 2. Unmount
sudo umount /dev/sdb1

# 3. Create partition table (GPT)
sudo parted /dev/sdb --script -- mklabel gpt

# 4. Create partition
sudo parted /dev/sdb --script -- mkpart primary exfat 0% 100%

# 5. Format as exFAT
sudo mkfs.exfat -L "MyUSB" /dev/sdb1

# 6. Verify
sudo blkid /dev/sdb1
# → /dev/sdb1: LABEL="MyUSB" UUID="..." TYPE="exfat"