Home Explore Blog Models CI



nixpkgs

nixos/doc/manual/installation/installing-usb.section.md
0340876d8c803218589263c59ca87a7477b64815602f8f31000000030000095e
# Booting from a USB flash drive {#sec-booting-from-usb}

The image has to be written verbatim to the USB flash drive for it to be
bootable on UEFI and BIOS systems. Here are the recommended tools to do that.

## Creating bootable USB flash drive with a graphical tool {#sec-booting-from-usb-graphical}

Etcher is a popular and user-friendly tool. It works on Linux, Windows and macOS.

Download it from [balena.io](https://www.balena.io/etcher/), start the program,
select the downloaded NixOS ISO, then select the USB flash drive and flash it.

::: {.warning}
Etcher reports errors and usage statistics by default, which can be disabled in
the settings.
:::

An alternative is [USBImager](https://bztsrc.gitlab.io/usbimager),
which is very simple and does not connect to the internet. Download the version
with write-only (wo) interface for your system. Start the program,
select the image, select the USB flash drive and click "Write".

## Creating bootable USB flash drive from a Terminal on Linux {#sec-booting-from-usb-linux}

1. Plug in the USB flash drive.
2. Find the corresponding device with `lsblk`. You can distinguish them by
   their size.
3. Make sure all partitions on the device are properly unmounted. Replace `sdX`
   with your device (e.g. `sdb`).

  ```ShellSession
  sudo umount /dev/sdX*
  ```

4. Then use the `dd` utility to write the image to the USB flash drive.

  ```ShellSession
  sudo dd bs=4M conv=fsync oflag=direct status=progress if=<path-to-image> of=/dev/sdX
  ```

## Creating bootable USB flash drive from a Terminal on macOS {#sec-booting-from-usb-macos}

1. Plug in the USB flash drive.
2. Find the corresponding device with `diskutil list`. You can distinguish them
   by their size.
3. Make sure all partitions on the device are properly unmounted. Replace `diskX`
   with your device (e.g. `disk1`).

  ```ShellSession
  diskutil unmountDisk diskX
  ```

4. Then use the `dd` utility to write the image to the USB flash drive.

  ```ShellSession
  sudo dd if=<path-to-image> of=/dev/rdiskX bs=4m
  ```

  After `dd` completes, a GUI dialog "The disk
  you inserted was not readable by this computer" will pop up, which can
  be ignored.

  ::: {.note}
  Using the 'raw' `rdiskX` device instead of `diskX` with dd completes in
  minutes instead of hours.
  :::

5. Eject the disk when it is finished.

  ```ShellSession
  diskutil eject /dev/diskX
  ```

Chunks
da0cfbf8 (1st chunk of `nixos/doc/manual/installation/installing-usb.section.md`)
Title: Creating a Bootable USB Flash Drive
Summary
This document provides instructions for creating a UEFI/BIOS bootable USB flash drive from an image. It outlines two methods: graphical tools and terminal commands. For graphical tools, Etcher (Linux, Windows, macOS) and USBImager are recommended; both involve selecting the image, then the USB, and flashing it. For terminal users: - **On Linux**: Identify device (`lsblk`), unmount partitions (`sudo umount /dev/sdX*`), then write image with `sudo dd bs=4M conv=fsync oflag=direct status=progress if=<path-to-image> of=/dev/sdX`. - **On macOS**: Identify device (`diskutil list`), unmount disk (`diskutil unmountDisk diskX`), then write image with `sudo dd if=<path-to-image> of=/dev/rdiskX bs=4m` (using `rdiskX` for speed). Ignore 'disk not readable' dialog; eject with `diskutil eject /dev/diskX`.