How To: Install Slax-6.0.7 On A USB Flash Drive

Andrew J. Nelson
Published: 12 September 2008
Revised: 6 November 2010

Introduction

This How To will explain partitioning and formatting a USB flash drive, and then installing Slax-6.0.7 onto that drive. The document covers methods for installing Slax onto either a Linux EXT3 partition or a Windows FAT32 partition from a Linux environment. It is intended to explain some general concepts and delve a bit deeper into the process than a simple "do this to make this happen" series of instructions.

The Slax Clover Leaf.

The Slax clover leaf, straight from Tomas' slax.org.

Links To Each Step

  1. Download Slax
  2. Determine The Drive Designation
  3. Partition The Drive
  4. Format The Drive
  5. Copy The Slax TAR File To The Formatted Partition
  6. Install Slax

Intended Audience

Generally, this How To is for anyone needing basic instructions for accomplishing this task, and is geared towards those people new to the Linux world. While Slax 6.0.7 is no longer the current version, it is in the same generation and all the general principles should still apply.

Required Materials and Prior Knowledge

First and foremost you will need a USB flash drive. As of this writing they are available everywhere from Wal-Mart to Newegg.com, and cost approximately $12 for a 2 GB drive, if you do a little comparison shopping. The minimum required size for this tutorial is 512 MB, although the original, un-modified Slax-6.0.7 can be shoe-horned onto a 256 MB stick. For all practical purposes, it is difficult to find a USB flash drive less than 1GB in size for sale any more.

The second requirement is a copy of the Slax-6.0.7 operating system. You can read about the basic Slax at slax.org. In addition to the basic version, there is another variant available for the purpose of this tutorial created by Andrew Nelson (me).

The third requirement is a PC running a Linux OS, such as Slackware 13.1 or Slax-6.0.7 from a CD on your own computer.

Last, while this How To does specify every needed command to complete the objective, it does not explain the usage for all of them. Explaining basic Linux commands is beyond the scope of this document.

Disclaimer

This process involves both partitioning and formatting a drive. Please be very careful when you do so! A careless keystroke can result in the deletion of an entire drive that you had no intention of losing. I have done this! Again, be careful! WebGnuru takes no responsibility for any loss of data, hardware, time, or hair that may result from following the instructions in this How To.

Step One: Download Slax

You will be downloading a Slax version in a TAR format. TAR is a compression format, analogous to the Windows ZIP format. Saltwater Slax is intended as a portable web development platform. Below is a synopsis.

  • A fully configured Apache/MySQL/PHP server.
  • Firefox
  • Telnet
  • Pine
  • LFTP and FTP
  • GIMP
  • Open Office

You can download my version here: webgnuru.com. The full README is also available in PDF.
The vanilla Slax-6.0.7 is avaiable here: slax.org

For simplicity, I recommend saving the download to your desktop. Once your download is complete, move on to the next step.

Back To The Top

Step Two: Determine The Drive Designation

From here on out I assume that you have a flash drive, the downloaded Slax tar file, and are sitting in front of a Linux computer. Lets get down to brass tacks.

Go to the command line or open a console session. Plug in your USB flash drive. If you are using a GUI, hit "cancel" when the "new medium detected" wizard pops up.

A screenshot of the "new medium detected" wizard.
A screenshot of the cancel option.

You will need to determine the drive designation. On the command line enter:

  • dmesg | tail

You will see output that says something similar to:

  • sd 3:0:0:0: [sdb] Attached SCSI removable disk

Your device designation is whatever is inside the brackets [ ], such as [sda], [sdb], [sdc] etc. (This stands for SCSI Device A, B, C etc.) Below is a screenshot of this process.

A screenshot of determining the USB flash drive designation from the command line.
a screenshot of dmesg | tail

Back To The Top

Step Three: Partitioning The Drive

For the rest of this How To I use sdb as the drive designation and slax.tar as the filename. If your drive designation and/or filename is different, replace as needed!

We will partition the USB flash drive with FDISK. Once again go to the console.

  • fdisk /dev/sdb

Next create a new, primary partition. I recommend changing the partition type to FAT32 as this allows you to access your data from both Linux and Windows; if this is not relevant or important to you leave it as a Linux EXT3 partition type. Make the partition active. Print the partition table to make sure that everything is correct, then write the changes.

As a note, I have found that my Slax installs on flash drives seem to hold up on longer on a FAT32 filesystem. This may be due to the fact the ext3 is a journaling FS, which causes far more read/writes than what a flash drive is accustomed to.

FDISK Commands
  • n: New Partition
  • t: Set Partition Type
  • b: Hex code for FAT 32
  • a: Set the bootable flag for the partition
  • p: View the partition table.
  • w: Write the changes.
  • q: Quit FDISK
  • m: FDISK Help

Your USB flash drive has now been partitioned. If you are in a GUI, when this completes, the "new medium detected" wizard will pop up again. Once again, just hit cancel. Here is a screenshot of what your fdisk table could look like.

A screenshot of using FDISK.
a screenshot of fdisk

Back To The Top

Step Four: Formatting The Partition

After the drive has been partitioned, the partition needs to be formatted. We will be doing this, again, from the command line. Please take notice that the device designation in these examples is sdb1 not sdb. The designation now means partition number 1 on SCSI device B.

How To Format a FAT 32 Partition
  • mkdosfs -F 32 /dev/sdb1
How To Format a Linux EXT3 Partition
  • mkfs.ext3 /dev/sdb1

Back To The Top

Step Five: Copying the TAR File to the Formatted Partition

In order to copy the TAR file to the formatted partition on the USB flash drive, the partition must first be mounted. This is a term which, when I was new to the Linux world, confused me. I did not exactly understand what mounting was.

Simply, mounting a device means attaching one file system to another. Your operating system is a file tree. One of the branches on that tree is the mnt/ directory. The USB flash drive is also a file tree; we will attach the USB file tree to the operating system file tree on the mnt/ "branch".

A good practice is to create a specific "twig" on the mnt/ "branch" for the USB file system to attach to. This is called creating a mount point. Let us return to the command line, create a mount point, and mount the USB flash drive's formatted partition to that point.

  1. Change into the mnt/ directory.
  2. Make a new directory and call it ufd/ (standing for USB Flash Drive).
  3. Take a look to make sure that the new directory was created.
  4. Mount the USB partition to the new directory.
The example commands to create a mount point and mount the drive:
  • cd /mnt
  • mkdir ufd
  • ls
  • mount /dev/sdb1 /mnt/ufd

Next, we need to copy the TAR file to the mounted drive partition. If you downloaded the file to your desktop, as root, the command looks like this:

  • cp -v /root/Desktop/slax.tar /mnt/ufd
A screenshot of formatting, mounting, and copying a file.
a screenshot of formatting, mounting, and copying a file

Back To The Top

Step Six: Installing Slax

In order to install Slax, we need to extract the TAR file. Extracting a TAR file is analogous to unzipping a ZIP file. To do this from the command line:

Extract the TAR File
  • cd /mnt/ufd
  • tar -xvf slax.tar

After the extraction is complete, you should now see two directories: slax/ and boot/. The next step is to initialize the Master Boot Record (MBR), which Tomas (the creator of Slax) has made very easy by providing a script that does all the work.

To Initialize The MBR on a FAT 32 Partition
  • cd /mnt/ufd/boot
  • ./bootinst.sh
To Initialize The MBR on an EXT3 Partition
  • cd /mnt/ufd/boot
  • ./liloinst.sh

Once you execute the script, follow the onscreen prompts. The process is very quick and easy. The next step is to remove the TAR file as it is no longer needed and is occupying quite a bit of space on your drive.

Delete The TAR File From The Drive
  • cd /mnt/ufd
  • rm slax.tar

Finally, un-mount the partition. This is important! Yanking a USB flash drive out of the port without first un-mounting it can corrupt the file system on the drive. This can make your Slax install not work.

Un-mount The Drive
  • cd /mnt
  • umount /dev/sdb1

You should now have a bootable USB drive with Slax installed on it. To test, turn off your computer, insert the drive, and turn the computer back on. when you restart the computer, you must either select the USB flash drive as the boot device on the quick-boot menu or set it as the first boot device in the BIOS boot order.

Back To The Top

Conclusion

The tux logo for WG.

Share this article on Google+ or your favorite social media. Thanks!

I hope that this How To provided a clear and consise method for installing Slax onto a USB flash drive, in terms that are easily understandable for someone new to a Linux environment. If you have any questions, concerns, suggestions, or constructive criticism, please email me.

Copyright © 2008 - 2013 Andrew Nelson under the GPL v3 License except where noted.
Please see the README file for full licensing disclosure and credits.