Building a Silent PC: My Quest for Quiet

Chapter 5: Flash Knoppix

Terry Gray

Original: 14 Jul 2003

Running KNOPPIX from HD or CF Without Installing it!

NOTE: this version has been superseded by this one

This document is inspired by and derived from an article at
However, there are (at this writing) still some bugs in that guide (as there may still be in this one.)

This is a guide to explain how to put the Knoppix distribution onto a hard drive or a Compact Flash IDE drive without actually installing it. (The HowTo page uses the term "HD Based" to contrast this scenario with an "HD install"). A drive with such a "non-installed" OS is used just like a "live CD", with the drive serving in lieu of the CDROM. This allows the CDROM drive to be used for other things, and is typically faster and quieter than using the CDROM. To reiterate: this is NOT a normal Linux install. The Knoppix kernel will still execute from RAMDISK, just as it does when running from CDROM.

One might wonder why this is an intersting thing to do. Why not just do a normal hard drive installation? A couple of reasons: First, one of the beauties of Knoppix is that it represents a complex unit that can be upgraded enmasse, with all local customization kept completely separate (not intermixed with the "installed" files). Second, normally-installed operating systems really like to write to their disk drives a lot. If you are a silent computing freak, this can be annoying, since the drives rarely spin down a sit quietly until you need to do something with them. So running Knoppix-style out of RAM Disk is an ideal solution for such things as small file/print servers. Third, if you want to use a Compact Flash IDE drive to hold the OS bits (i.e. a CF card plugged into a CF-IDE adapter), thereby eliminating all the rotating machinery needed to keep the OS functioning, this RAMdisk-based mode of operation is again ideal, because it avoids the stress of swap files or log files that wear out CF cards (since they have limited life for writing, as compared to reading data.) Finally, there is an opportunity to adjust the default boot options to your liking, so you don't have to type in your desired kernel boot options every time you start Knoppix. (Examples include "home", "myconf", and "dma".)

We'll start by running KNOPPIX from CDROM... but: We need a target drive and a staging drive. They can be the same drive if big enough (at least 1.5GB free), but if you want to use a 1GB flash drive for the target, you'll need a separate HD for staging.

If you want to use the same target drive for saving Knoppix configs or for the Knoppix "persistent home", I suggest making a separate partition for that on the target drive, since Knoppix will take exclusive control of the partition it boots from. Or you can use a separate USB flash drive for saving configs and/or persistent home (which is what I do). Creating multiple partitions on the target drive, one dedicated for storing and booting the Knoppix image files, is beyond the scope of this guide.

We need a root shell. Either select one from the KNOPPIX menu under the KDE start button, or start a regular terminal window and enter the command: sudo bash

The device name for the target drive depends on how it is attached to the computer, and whether it is configured via hardware jumper on the drive as a master or slave:
MASTER on PRIMARY IDE == /dev/hda
SLAVE on PRIMARY IDE == /dev/hdb
SLAVE on SECONDARY IDE == /dev/hdd

The following instructions, assume that the target drive is /dev/hda and the staging drive is /dev/hdb
Remember that you can use the target drive for staging if it's big enough (not the case if the target is a 1GB compact flash card). If using the same drive for both target and staging, change "hdb1" to "hda1" in the commands below.

We need a source of files. I'm not sure whether you can mount the CDROM to copy from when Knoppix is executing from it. To avoid that issue, we'll assume that a Knoppix ISO file can be made available, which need not be the same version as that running.

You can use the new/target disk to store it if it has at least 1.5GB available, or you can use any other disk as a place to save the Knoppix ISO file. For this example, we'll save the ISO file on a separate staging drive as /mnt/hdb1/newknoppix.iso

There are three steps to the process:

  1. Prepare the destination (target) drive
  2. Prepare the lilo configuration file
  3. Copy files to the right places, Run lilo, and Reboot (without the Knoppix CDROM)

Let's get started... (from a root shell)

Step 1: Preparing the destination drive

If you are starting with a fresh hard drive or CF IDE drive, or want to make a fresh start with an existing drive, you will need to format it and make Knoppix aware of the new configuration:

# This group of commands initialize a new disk and is
# not needed for subsequent updates...
# Makefilesystem... mkfs destroys existing data!
 mkfs /dev/hda1  # use default ext2
# Now rebuild /etc/fstab with the new drive info
 rebuildfstab -r   # Remount using new fstab entry 
 mount /dev/hda1

Step 2: Preparing the lilo configuration file

We're going to use the lilo bootloader, which is different than the Syslinux loader used on the Knoppix ISO... so we need to create a lilo.conf file. For now we'll put it on our staging drive, /dev/hdb1

You can grab /etc/lilo.conf as a template ( cp /etc/lilo.conf /mnt/hdb1 ) and edit it, or copy the following lines into it using your favorite Knoppix text editor, e.g. vim /mnt/hdb1/lilo.conf

# /etc/lilo.conf - See: `lilo(8)' and `lilo.conf(5)',

backup=/dev/null #don't bother to save old MBR state
lba32          #enable large disk support
prompt         #offer chance to override default kernel options
timeout=100    #wait 10 seconds before auto-booting
boot=/dev/hda  #put boot loader in MBR of /dev/hda
root=/dev/hda1 #set root to be /dev/hda1
image=/boot/vmlinuz  #file containing image to boot
	initrd=/boot/miniroot.gz  #initial ram disk contents
	append="ramdisk_size=100000 init=/etc/init lang=us apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi vga=791 nomce quiet BOOT_IMAGE=/KNOPPIX/KNOPPIX home=scan myconf=scan dma"


I've added "home" "myconf" and "dma" parameters, which are not part of the Knoppix default APPEND string.

The "BOOT_IMAGE" path in the APPEND string must be modified from the value in the sample /etc/lilo.conf file to point to the compressed KNOPPIX file within the KNOPPIX top-level directory on the target drive where it will be copied in step three.

My experience is that the "initrd=" value found in the Syslinux APPEND directive MUST be removed from the lilo "APPEND" directive for lilo booting to work properly, and turned into a separate lilo directive, with the path changed to point at the miniroot.gz file in the /boot directory. (That's /boot in the lilo context, where / is defined by the root directive set previously.)

The syslinux config file in the Knoppix boot directory specifies "ramdisk_size=100000" as a kernel parameter in the "append" directive, and I have included it above. However, the "man lilo.conf" documentation refers to a "ramdisk =" directive (separate from the APPEND kernel parameters). I don't know which is correct for this configuration.

Other boot menu options were omitted for brevity. I have an additional "vanilla" entry that omits the "home=scan", "myconf=scan", and "dma" values from the APPEND. You can add other boot alternatives at the end of the file if you want.

Step 3: Copying files, Running LILO, Rebooting

Summary of Commands

The instructions below may lend themselves to becoming a script for installing new Knoppix releases as they become available, but I have not yet tested that idea.

# Assumes target drive is /dev/hda and is already formatted
# Assumes source ISO file is in /mnt/hdb1/newknoppix.iso
# Assumes the desired lilo.conf is in /mnt/hdb1/lilo.conf
mount /dev/hda1   # mount target drive
mkdir /mnt/staging # make a place to mount the ISO file
mount -t iso9660 -o loop,ro /mnt/hdb1/newknoppix.iso /mnt/staging
cp -af /mnt/staging/* /mnt/hda1
mkdir /mnt/bootimage # make a place to mount the boot.img file
mount -t vfat -o loop /mnt/staging/KNOPPIX/boot.img /mnt/bootimage
mkdir /mnt/hda1/boot
cp -af /mnt/bootimage/* /mnt/hda1/boot
cp /mnt/hdb1/lilo.conf /mnt/hda1/boot # copy the lilo config file
ln -sf /mnt/hda1/boot /
lilo -C /mnt/hda1/boot/lilo.conf

Annotated Command Script

# Running KNOPPIX from HD or CF Without Installing it
# Terry Gray
# 12 Jul 2003
# Inspired by
# but the original didn't work for me...

# Current Knoppix as of this writing: 3.2 of 6 Jun 03
# Assumes target drive is /dev/hda and is already formatted
# Assumes source ISO file is in /mnt/hdb1/newknoppix.iso
# Assumes the desired lilo.conf is in /mnt/hdb1/lilo.conf

mount /dev/hda1  # Mount the new target drive 
# Assumes Knoppix recognized it, and it is by now formatted

# We need to mount the ISO file using the loopback driver.
# Start by creating a mount point directory; we'll call it "staging"
mkdir /mnt/staging
mount -t iso9660 -o loop,ro /mnt/hdb1/newknoppix.iso /mnt/staging
# Now copy the contents of the mounted ISO to the target drive
cp -af /mnt/staging/* /mnt/hda1
# We'll only need the "f" flag for subsequent updates to
# blow away the old files.

# Now we need to extract files from the floppy boot image stored 
# in the Knoppix boot directory.  We'll need them for booting from 
# the hard drive...  Start by creating a mount point for the floppy 
# image:
mkdir /mnt/bootimage

# Now mount the boot.img file using the loopback driver
mount -t vfat -o loop /mnt/staging/KNOPPIX/boot.img /mnt/bootimage

# On the target drive we need a place to put the boot files
mkdir /mnt/hda1/boot
# Now copy the files from the floppy boot image:
cp -af /mnt/bootimage/* /mnt/hda1/boot
# Again, the "f" flag only needed for subsequent updates
# I think only "vmlinuz" and "miniroot.gz" files are needed, but the 
# others don't take up much space.

cp /mnt/hdb1/lilo.conf /mnt/hda1/boot # copy the lilo config file

# lilo writes the necessary boot sector info to the target drive,
# but it also needs to write a map file somewhere... 
# The following command creates a sym link from the read-only knoppix 
# /boot directory to the read-write /mnt/hda1/boot directory:
ln -sf /mnt/hda1/boot /

# Now run lilo:
lilo -C /mnt/hda1/boot/lilo.conf
# you could also say
## lilo -C /boot/lilo.conf
# which is equivalent due to the preceding symbolic link command.
# lilo should say "Added Knoppix" and maybe also complain about not 
# being able to determine current vga display settings.

# Now we're ready to reboot:

# Be sure to take the CDROM out when you get the Knoppix prompt to do so,
# and make sure your BIOS is configured to boot from a hard drive.
# If all goes well, you'll reboot from the new target drive.

Notes on using Compact Flash as the boot/target drive

Even though I have a motherboard BIOS that claims to be able to boot from "USB HD", I've never gotten USB flash drives to work as boot devices. On the other hand, I have succeeded in using regular CF cards plugged into a CF-IDE adapter. These behave just like a normal hard drive, except...
-lilo reported a number of errors, but booting worked anyway.
-After booting Knoppix, running dmesg shows several pages of errors: kmod: failed to exec /sbin/modprobe -s -k block-major-8, errno = 2 followed by the error: Unable to identify CD-ROM format. However, booting appears to proceed normally after that.

This is one of a series of articles describing my silent computing adventures. This link will take you to the beginning of the story.