vuls: init at 0.27.0
[NixPkgs.git] / nixos / doc / manual / installation / installing-usb.section.md
blob3b9e2f492f04d694d534a875ab34d5f754236cdb
1 # Booting from a USB flash drive {#sec-booting-from-usb}
3 The image has to be written verbatim to the USB flash drive for it to be
4 bootable on UEFI and BIOS systems. Here are the recommended tools to do that.
6 ## Creating bootable USB flash drive with a graphical tool {#sec-booting-from-usb-graphical}
8 Etcher is a popular and user-friendly tool. It works on Linux, Windows and macOS.
10 Download it from [balena.io](https://www.balena.io/etcher/), start the program,
11 select the downloaded NixOS ISO, then select the USB flash drive and flash it.
13 ::: {.warning}
14 Etcher reports errors and usage statistics by default, which can be disabled in
15 the settings.
16 :::
18 An alternative is [USBImager](https://bztsrc.gitlab.io/usbimager),
19 which is very simple and does not connect to the internet. Download the version
20 with write-only (wo) interface for your system. Start the program,
21 select the image, select the USB flash drive and click "Write".
23 ## Creating bootable USB flash drive from a Terminal on Linux {#sec-booting-from-usb-linux}
25 1. Plug in the USB flash drive.
26 2. Find the corresponding device with `lsblk`. You can distinguish them by
27    their size.
28 3. Make sure all partitions on the device are properly unmounted. Replace `sdX`
29    with your device (e.g. `sdb`).
31   ```ShellSession
32   sudo umount /dev/sdX*
33   ```
35 4. Then use the `dd` utility to write the image to the USB flash drive.
37   ```ShellSession
38   sudo dd bs=4M conv=fsync oflag=direct status=progress if=<path-to-image> of=/dev/sdX
39   ```
41 ## Creating bootable USB flash drive from a Terminal on macOS {#sec-booting-from-usb-macos}
43 1. Plug in the USB flash drive.
44 2. Find the corresponding device with `diskutil list`. You can distinguish them
45    by their size.
46 3. Make sure all partitions on the device are properly unmounted. Replace `diskX`
47    with your device (e.g. `disk1`).
49   ```ShellSession
50   diskutil unmountDisk diskX
51   ```
53 4. Then use the `dd` utility to write the image to the USB flash drive.
55   ```ShellSession
56   sudo dd if=<path-to-image> of=/dev/rdiskX bs=4m
57   ```
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.
63   ::: {.note}
64   Using the 'raw' `rdiskX` device instead of `diskX` with dd completes in
65   minutes instead of hours.
66   :::
68 5. Eject the disk when it is finished.
70   ```ShellSession
71   diskutil eject /dev/diskX
72   ```