Determine the Device Name of the Flash Medium

Determine the name your computer uses for your flash medium. The following step is one way to do this.

After inserting the flash medium, run the command:

dmesg

At the end of this command you should see the name of your flash medium, likely starting with "sd". (For example: "sda").

The remainder of this document will assume that your flash medium is called /dev/sda

Warning: Be very careful about this. You do not want to mistakenly wipe your hard drive if it's on /dev/sda

Format Flash Medium

Run fdisk (replacing sda with your flash medium name):

fdisk /dev/sda

(Optional) - Create new partition table with one FAT32 partition

d Delete all partitions (this may take a few steps)

n Create a new partition

p A primary partition

1 Partition number 1

Use defaults for first and last cylinder (just press [Enter] twice).

t Change partition type

c Partition type (Win95 FAT32/LBA)

Verify that the primary partition is bootable

p Print list of partitions

If there is no '*' next to the first partition, follow the next steps:

aMake the partition bootable (set boot flag)

1 Partition number 1

w Write your changes to the device

Add Alpine Linux to the Flash Medium

To boot from your flash medium you need to copy the contents of the CDROM to the flash medium and make it bootable. Those two operations can be automated with the setup-bootable tool or can be done manually.

Note: If the following commands fail due to 'No such file or directory', you may have to remove and reinsert the flash medium, or even reboot, to get /dev/sda1 to appear

Automated

Tip: If using Alpine Linux 1.10.4 or newer, you can use this section to complete the install. Otherwise, follow the Manual steps below.

Note: The target partition has to be formatted. Use the mkdosfs command from the Manual steps below if needed.

Run the setup-bootable script to add Alpine Linux to the flash medium and make it bootable (replacing sda with your flash medium name):

setup-bootable /media/cdrom /dev/sda1

Warning: If you are installing to a USB Stick, you may need to modify the syslinux.cfg file to say usbdisk as described below, or you will face possible problems booting and definite problems with the package cache. Recent versions of setup-bootable will specify the alpine_dev using a UUID instead, so it should work properly by default.

Manual

(Optional) - If you created a new partition above, format the flash medium with a FAT32 filesystem (replacing sda with your flash medium name):