# How to Create a Bootable Debian USB Drive on Linux

Creating a bootable USB drive is a straightforward process, but it requires careful attention to detail to ensure you're working with the correct device and not risking any data. This guide will walk you through the entire process, from verification to completion, for creating a bootable Debian USB drive.

## Prerequisites

- A Linux operating system with terminal access.
- A USB drive with at least 4GB of storage (all data on the USB drive will be erased).
- A Debian ISO file downloaded to your system.

## Steps

### 1. Identify Your USB Drive

First, insert your USB drive and use the `dmesg` command to identify it:

```bash
sudo dmesg | tail
```

Look for messages that indicate a new USB device has been connected, usually showing a device name like `/dev/sda` and the size of the drive.

### 2. Verify the Device with `lsblk`

Run `lsblk` before and after inserting the USB drive to see which device appears:

```bash
lsblk
```

The new device (e.g., `/dev/sda`) that appears is your USB drive.

### 3. Unmount the USB Drive

If any partitions on the USB drive are mounted, unmount them using:

```bash
sudo umount /dev/sdxN
```

Replace `/dev/sdxN` with the actual device and partition number (e.g., `/dev/sda1`).

### 4. Write the Debian ISO to the USB Drive

Use the `dd` command to write the ISO file to the USB drive:

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

Replace `/path/to/debian.iso` with the path to your Debian ISO file and `/dev/sdx` with your USB drive device name.

- `if=` specifies the input file.
- `of=` specifies the output file (your USB drive).
- `bs=4M` sets the block size to 4 MB.
- `status=progress` shows the writing progress.
- `oflag=sync` ensures all data is written and synchronized.

### 5. Eject the USB Drive

After the `dd` command finishes, ensure all data is written:

```bash
sync
```

Safely remove the USB drive from your computer.

### 6. Boot from the USB Drive

Insert the bootable USB drive into the target computer and restart it. You may need to enter the BIOS/UEFI settings to change the boot order or select the USB drive as the first boot option.

## Conclusion

By following these steps, you've created a bootable Debian USB drive ready for installation. Remember, the `dd` command is powerful and can overwrite any data on the target device, so double-check the device name before proceeding.