1# Booting from a USB flash drive {#sec-booting-from-usb}
2
3The image has to be written verbatim to the USB flash drive for it to be
4bootable on UEFI and BIOS systems. Here are the recommended tools to do that.
5
6## Creating bootable USB flash drive with a graphical tool {#sec-booting-from-usb-graphical}
7
8Etcher is a popular and user-friendly tool. It works on Linux, Windows and macOS.
9
10Download it from [balena.io](https://www.balena.io/etcher/), start the program,
11select the downloaded NixOS ISO, then select the USB flash drive and flash it.
12
13::: {.warning}
14Etcher reports errors and usage statistics by default, which can be disabled in
15the settings.
16:::
17
18An alternative is [USBImager](https://bztsrc.gitlab.io/usbimager),
19which is very simple and does not connect to the internet. Download the version
20with write-only (wo) interface for your system. Start the program,
21select the image, select the USB flash drive and click "Write".
22
23## Creating bootable USB flash drive from a Terminal on Linux {#sec-booting-from-usb-linux}
24
251. Plug in the USB flash drive.
262. Find the corresponding device with `lsblk`. You can distinguish them by
27 their size.
283. Make sure all partitions on the device are properly unmounted. Replace `sdX`
29 with your device (e.g. `sdb`).
30
31 ```ShellSession
32 sudo umount /dev/sdX*
33 ```
34
354. Then use the `dd` utility to write the image to the USB flash drive.
36
37 ```ShellSession
38 sudo dd if=<path-to-image> of=/dev/sdX bs=4M conv=fsync
39 ```
40
41## Creating bootable USB flash drive from a Terminal on macOS {#sec-booting-from-usb-macos}
42
431. Plug in the USB flash drive.
442. Find the corresponding device with `diskutil list`. You can distinguish them
45 by their size.
463. Make sure all partitions on the device are properly unmounted. Replace `diskX`
47 with your device (e.g. `disk1`).
48
49 ```ShellSession
50 diskutil unmountDisk diskX
51 ```
52
534. Then use the `dd` utility to write the image to the USB flash drive.
54
55 ```ShellSession
56 sudo dd if=<path-to-image> of=/dev/rdiskX bs=4m
57 ```
58
59 After `dd` completes, a GUI dialog "The disk
60 you inserted was not readable by this computer" will pop up, which can
61 be ignored.
62
63 ::: {.note}
64 Using the 'raw' `rdiskX` device instead of `diskX` with dd completes in
65 minutes instead of hours.
66 :::
67
685. Eject the disk when it is finished.
69
70 ```ShellSession
71 diskutil eject /dev/diskX
72 ```