{{Article summary text|Guide to installing, configuring and using a full-featured Arch Linux system on a USB flash drive.}}

+

{{Related|Beginners' guide}}

−

{{Article summary heading|Related}}

+

{{Related|Installation guide}}

−

{{Article summary wiki|Beginners' Guide}}

+

{{Related|General recommendations}}

−

{{Article summary wiki|Installation Guide}}

+

{{Related|General Troubleshooting}}

−

{{Article summary wiki|General Recommendations}}

+

{{Related articles end}}

−

{{Article summary wiki|General Troubleshooting}}

−

{{Article summary end}}

−

This page explains how to perform a regular Arch installation onto a USB key (or "flash drive"). In contrast to having a LiveUSB as covered in [[USB Installation Media]], the result will be a persistent installation identical to normal installation to HDD, but on a USB flash drive.

This page explains how to perform a regular Arch installation onto a USB key (or "flash drive"). In contrast to having a LiveUSB as covered in [[USB Installation Media]], the result will be a persistent installation identical to normal installation to HDD, but on a USB flash drive.

Line 19:

Line 16:

There are various ways of installing Arch on a USB stick, the simplest being from within Arch itself:

There are various ways of installing Arch on a USB stick, the simplest being from within Arch itself:

−

* If you are already running Arch, simply [[pacman|install]] {{Pkg|arch-install-scripts}} and proceed with the [[Installation Guide]] just like you would from the iso, but you will not be using /dev/sda. Use {{ic|$ lsblk}} to get the /dev/sd* name of your USB key prior to installation.

+

* If you are already running Arch, simply [[pacman|install]] {{Pkg|arch-install-scripts}} and proceed with the [[Installation guide]] just like you would from the iso, but you will not be using /dev/sda. Use {{ic|$ lsblk}} to get the /dev/sd* name of your USB key prior to installation.

{{Warning|If you mistakingly format /dev/sda, you are likely to go about deleting everything on your hard drive.}}

{{Warning|If you mistakingly format /dev/sda, you are likely to go about deleting everything on your hard drive.}}

−

* An Arch Linux CD/USB can be used to install Arch onto the USB key, via booting the CD/USB and following the [[Installation Guide]]. If booting from a Live USB, the installation will have to be made on a different USB stick.

+

* An Arch Linux CD/USB can be used to install Arch onto the USB key, via booting the CD/USB and following the [[Installation guide]]. If booting from a Live USB, the installation will have to be made on a different USB stick.

* Or, if you have another Linux computer available (it need not be Arch), you can follow the instructions to [[Install_from_Existing_Linux|install from existing Linux]], and then skip to the configuration section.

* Or, if you have another Linux computer available (it need not be Arch), you can follow the instructions to [[Install_from_Existing_Linux|install from existing Linux]], and then skip to the configuration section.

Line 29:

Line 26:

* If cfdisk fails with "Partition ends in the final partial cylinder" fatal error, the only way to proceed is to kill all partitions on the drive. Open another terminal ({{ic|Alt+F2}}), type {{ic|fdisk /dev/sdX}} (where {{ic|sdX}} is your usb drive), print partition table (p), check that it's ok, delete it (d) and write changes (w). Now return to cfdisk.

* If cfdisk fails with "Partition ends in the final partial cylinder" fatal error, the only way to proceed is to kill all partitions on the drive. Open another terminal ({{ic|Alt+F2}}), type {{ic|fdisk /dev/sdX}} (where {{ic|sdX}} is your usb drive), print partition table (p), check that it's ok, delete it (d) and write changes (w). Now return to cfdisk.

−

* It is highly recommended to review the [https://wiki.archlinux.org/index.php/SSD#Tips_for_Minimizing_SSD_Read.2FWrites Tips for Minimizing SSD Read/Writes] on the [[SSD]] wiki article prior to selecting a filesystem. To sum up, ext4 without a journal should be fine. Recognize that flash has a limited number of writes, and a journaling file system will take some of these as the journal is updated. For this same reason, it is best to forgo a swap partition. Note that this does not affect installing onto a USB hard drive.

+

* It is highly recommended to review the [https://wiki.archlinux.org/index.php/SSD#Tips_for_Minimizing_SSD_Read.2FWrites Tips for Minimizing SSD Read/Writes] on the [[SSD]] wiki article prior to selecting a filesystem. To sum up, [http://fenidik.blogspot.com/2010/03/ext4-disable-journal.html ext4 without a journal] should be fine, which can be created with {{ic|# mkfs.ext4 -O ^has_journal /dev/sdXX}}. Recognize that flash has a limited number of writes, and a journaling file system will take some of these as the journal is updated. For this same reason, it is best to forget the swap partition. Note that this does not affect installing onto a USB hard drive.

* Before creating the initial RAM disk {{ic|# mkinitcpio -p linux}}, in {{ic|/etc/mkinitcpio.conf}} add the {{ic|block}} hook to the hooks array right after udev. This is necessary for appropriate module loading in early userspace.

* Before creating the initial RAM disk {{ic|# mkinitcpio -p linux}}, in {{ic|/etc/mkinitcpio.conf}} add the {{ic|block}} hook to the hooks array right after udev. This is necessary for appropriate module loading in early userspace.

+

* If you want to be able to continue to use the UFD device as a cross-platform removable drive, this can be accomplished by creating a partition housing an appropriate file system (most likely NTFS). Note that the data partition may need to be the first partition on the device, as Windows assumes that there can only be one partition on a removable device, and will happily automount an EFI system partition otherwise. Remember to install {{Pkg|dosfstools}} and {{Pkg|ntfs-3g}}. Some tools are available online that may allow you to flip the removable media bit on your UFD device this would trick operating systems into treating your UFD device as an external hard disk and allow you to use whichever partitioning scheme you choose.

+

{{Warning|It is not possible to flip the removable media bit on every UFD device and attempting to use software that is incompatible with your device may damage it. Attempting to flip the removable media bit is '''not''' recommended.}}

== Configuration ==

== Configuration ==

Line 88:

Line 87:

==== Architecture ====

==== Architecture ====

−

For the most versatile compatibility it is recommended that you install the x86_64 architecture with [[multilib]] support because it will run on both 32 and 64 bit architectures.

+

For the most versatile compatibility it is recommended that you install the i686 architecture because it will run on both 32 (IA-32) and 64 (amd64) bit architectures.

+

+

Additionally, due to the reduzed size of 32 bit binaries and the absence of (possible) multilib packages, an i686 installation typically consumes less space than an equivalent x86_64 one.

−

{{Note|If you have installed i686 architecture and would like to migrate to x86_64, please refer to the [[Migrating Between Architectures Without Reinstalling]] wiki article for help.}}

+

{{Note|Chrooting into a 64 bit linux installation (eg. when using the USB key as install/rescue media) is only possible from x86_64 Arch.}}

==== Input drivers ====

==== Input drivers ====

Line 117:

Line 118:

{{Warning|Some [[Xorg]] drivers will not work with KMS disabled. See the wiki page on your specific driver for details. Nouveau in particular needs KMS to determine the correct display resolution. If you add {{ic|nomodeset}} as a kernel parameter as a preemptive measure you may have to adjust the display resolution manually when using machines with Nvidia video cards. See [[Xrandr]] for more info.}}

{{Warning|Some [[Xorg]] drivers will not work with KMS disabled. See the wiki page on your specific driver for details. Nouveau in particular needs KMS to determine the correct display resolution. If you add {{ic|nomodeset}} as a kernel parameter as a preemptive measure you may have to adjust the display resolution manually when using machines with Nvidia video cards. See [[Xrandr]] for more info.}}

+

+

=== Compatibility ===

+

+

The fallback image should be used for maximum compatibility.

=== Optimizing for the lifespan of flash memory ===

=== Optimizing for the lifespan of flash memory ===

Line 124:

Line 129:

== See also ==

== See also ==

−

* [[Official Arch Linux Install Guide]]

+

* [[Installation guide]]

* [[Installing Arch Linux from VirtualBox]]

* [[Installing Arch Linux from VirtualBox]]

* [[Solid State Drives]]

* [[Solid State Drives]]

Revision as of 03:19, 17 February 2014

This page explains how to perform a regular Arch installation onto a USB key (or "flash drive"). In contrast to having a LiveUSB as covered in USB Installation Media, the result will be a persistent installation identical to normal installation to HDD, but on a USB flash drive.

Preparation

Note: At least 2 GiB of storage space is recommended. A modest set of packages will fit, leaving a little free space for storage.

There are various ways of installing Arch on a USB stick, the simplest being from within Arch itself:

If you are already running Arch, simply installarch-install-scripts and proceed with the Installation guide just like you would from the iso, but you will not be using /dev/sda. Use $ lsblk to get the /dev/sd* name of your USB key prior to installation.

Warning: If you mistakingly format /dev/sda, you are likely to go about deleting everything on your hard drive.

An Arch Linux CD/USB can be used to install Arch onto the USB key, via booting the CD/USB and following the Installation guide. If booting from a Live USB, the installation will have to be made on a different USB stick.

Or, if you have another Linux computer available (it need not be Arch), you can follow the instructions to install from existing Linux, and then skip to the configuration section.

Installation

If cfdisk fails with "Partition ends in the final partial cylinder" fatal error, the only way to proceed is to kill all partitions on the drive. Open another terminal (Alt+F2), type fdisk /dev/sdX (where sdX is your usb drive), print partition table (p), check that it's ok, delete it (d) and write changes (w). Now return to cfdisk.

It is highly recommended to review the Tips for Minimizing SSD Read/Writes on the SSD wiki article prior to selecting a filesystem. To sum up, ext4 without a journal should be fine, which can be created with # mkfs.ext4 -O ^has_journal /dev/sdXX. Recognize that flash has a limited number of writes, and a journaling file system will take some of these as the journal is updated. For this same reason, it is best to forget the swap partition. Note that this does not affect installing onto a USB hard drive.

Before creating the initial RAM disk # mkinitcpio -p linux, in /etc/mkinitcpio.conf add the block hook to the hooks array right after udev. This is necessary for appropriate module loading in early userspace.

If you want to be able to continue to use the UFD device as a cross-platform removable drive, this can be accomplished by creating a partition housing an appropriate file system (most likely NTFS). Note that the data partition may need to be the first partition on the device, as Windows assumes that there can only be one partition on a removable device, and will happily automount an EFI system partition otherwise. Remember to install dosfstools and ntfs-3g. Some tools are available online that may allow you to flip the removable media bit on your UFD device this would trick operating systems into treating your UFD device as an external hard disk and allow you to use whichever partitioning scheme you choose.

Warning: It is not possible to flip the removable media bit on every UFD device and attempting to use software that is incompatible with your device may damage it. Attempting to flip the removable media bit is not recommended.

Configuration

Make sure that /etc/fstab includes the correct partition information for /, and for any other partitions on the USB key. If the usb key is to be booted on several machines, it is quite likely that devices and number of available hard disks vary. So it is advised to use UUID or label:

To get the proper UUIDs for your partitions issue blkid

Note:

When GRUB is installed on the USB key, the key will always be hd0,0.

It seems that current versions of GRUB will automatically default to using uuid. The following directions are for GRUB legacy.

GRUB legacy

menu.lst, the GRUB legacy configuration file, should be edited to (loosely) match the following:
With the static /dev/sdaX:

Persistent block device naming

Alternatively, you may create udev rule to create custom symlink for your usb key. Then use this symlink in fstab and bootloader configuration. See udev#Setting static device names for details.

Kernel parameters

You may want to disable KMS for various reasons, such as getting a blank screen or a "no signal" error from the display, when using some Intel video cards, etc. To disable KMS, add nomodeset as a kernel parameter. See Kernel parameters for more info.

Warning: Some Xorg drivers will not work with KMS disabled. See the wiki page on your specific driver for details. Nouveau in particular needs KMS to determine the correct display resolution. If you add nomodeset as a kernel parameter as a preemptive measure you may have to adjust the display resolution manually when using machines with Nvidia video cards. See Xrandr for more info.