at 18.03-beta 2.6 kB view raw
1<section xmlns="http://docbook.org/ns/docbook" 2 xmlns:xlink="http://www.w3.org/1999/xlink" 3 xmlns:xi="http://www.w3.org/2001/XInclude" 4 version="5.0" 5 xml:id="sec-booting-from-usb"> 6 7<title>Booting from a USB Drive</title> 8 9<para>For systems without CD drive, the NixOS live CD can be booted from 10a USB stick. You can use the <command>dd</command> utility to write the image: 11<command>dd if=<replaceable>path-to-image</replaceable> 12of=<replaceable>/dev/sdb</replaceable></command>. Be careful about specifying the 13correct drive; you can use the <command>lsblk</command> command to get a list of 14block devices.</para> 15 16<para>On macOS: 17<programlisting> 18$ diskutil list 19[..] 20/dev/diskN (external, physical): 21 #: TYPE NAME SIZE IDENTIFIER 22[..] 23$ diskutil unmountDisk diskN 24Unmount of all volumes on diskN was successful 25$ sudo dd bs=1m if=nix.iso of=/dev/rdiskN 26</programlisting> 27Using the 'raw' <command>rdiskN</command> device instead of <command>diskN</command> 28completes in minutes instead of hours. After <command>dd</command> completes, a GUI 29dialog "The disk you inserted was not readable by this computer" will pop up, which 30can be ignored.</para> 31 32<para>The <command>dd</command> utility will write the image verbatim to the drive, 33making it the recommended option for both UEFI and non-UEFI installations. For 34non-UEFI installations, you can alternatively use 35<link xlink:href="http://unetbootin.sourceforge.net/">unetbootin</link>. If you 36cannot use <command>dd</command> for a UEFI installation, you can also mount the 37ISO, copy its contents verbatim to your drive, then either: 38 39<itemizedlist> 40 <listitem> 41 <para>Change the label of the disk partition to the label of the ISO 42 (visible with the blkid command), or</para> 43 </listitem> 44 <listitem> 45 <para>Edit <filename>loader/entries/nixos-livecd.conf</filename> on the drive 46 and change the <literal>root=</literal> field in the <literal>options</literal> 47 line to point to your drive (see the documentation on <literal>root=</literal> 48 in <link xlink:href="https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt"> 49 the kernel documentation</link> for more details).</para> 50 </listitem> 51 <listitem> 52 <para>If you want to load the contents of the ISO to ram after bootin 53 (So you can remove the stick after bootup) you can append the parameter 54 <literal>copytoram</literal>to the <literal>options</literal> field.</para> 55 </listitem> 56</itemizedlist> 57</para> 58 59</section>