Many users have a single operating system installed at their laptops and they don't want to risk loosing their job by installing a second operating system (especially these users that rely on one single internal hard drive).
So here is a way to install a popular linux distribution called arch-linux , on a usb flash drive.
The complete guide for arch linux beginners is located here : Beginners' Guide
This guide is great but here what you should do to run arch-linux completely from an external flash drive.
The operating system that I am running for this example is windows 8.
1.First we create an arch-linux live cd from this link : https://www.archlinux.org/download/
2.Boot using live cd, and you are automatically logged in as root
3.Check with
lsblk
that the USB device is not mounted.
At this stage you should probably see your system internal hdd as sda and your external flash drive as sdb.
4. run
cfdisk /dev/sdb
The example system will contain a 15 GB root partition, and a home partition for the remaining space.
It should be emphasized that partitioning is a personal choice and that this example is only for illustrative purposes. See Partitioning.
Root:- Choose New (or press
N
) - Enter
for Primary - type in "15360" - Enter
for Beginning - Enter
for Bootable.- Press the down arrow to move to the free space area.
- Choose New (or press
N
) -Enter
for Primary -Enter
to use the rest of the drive (or you could type in the desired size).
Here's how it should look like:
Name Flags Part Type FS Type [Label] Size (MB) ----------------------------------------------------------------------- sda1 Boot Primary Linux 15360 sda2 Primary Linux 133000*
Double check and make sure that you are happy with the partition sizes as well as the partition table layout before continuing.
If you would like to start over, you can simply select Quit (or press Q
) to exit without saving changes and then restart cfdisk.
If you are satisfied, choose Write (or press Shift+W
) to finalize and to write the partition table to the drive. Type "yes" and choose Quit (or press Q
) to exit cfdisk without making any more changes.
5. run
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdb2
Now both flash drive partitions are formated with the ext4 filesystem.
6. Follow the rest of the Beginners' Guide and pay attention to these parts :
i) Create an initial ram disk environment.
Study well this document ( Hooks) and add the usb word in the
/etc/mkinitcpio.conf
at the proper line.
ii) Install and configure a bootloader.
Grub is a good choice if you use windows, so use the Grub instructions here.
If you get any errors when trying to execute
grub-install --target=i386-pc --recheck /dev/sdb
you can try (like me) to add the following -force parameter like this
grub-install --target=i386-pc --recheck --debug --force /dev/sdb
iii) Add your windows operating system option when you boot from the flash drive by doing the following (with root privileges) :
pacman -S os-prober
to install the os-prober package and then run
grub-mkconfig -o /boot/grub/grub.cfg
to create the boot screen menu.
Now you have a complete operating system installed in your flash drive, without touching your system's internal hard drive!