O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  



HACK
#5
Free Your CD to Make Knoppix Run Faster
Make Knoppix run faster by loading the Knoppix image to RAM or saving it to the hard drive. This also frees your CD-ROM drive for other uses
[Discuss (8) | Link to this hack]

Compared to other live-CD distributions, Knoppix runs surprisingly quickly, considering that it downloads data from a compressed image on the CD. If you want to speed things up, but aren't ready to install Knoppix on your hard drive just yet, there are cheat codes that allow you to copy the complete Knoppix CD image to either RAM or a partition on your hard drive, and run it completely from there. These cheat codes give you the added benefit of freeing up the CD-ROM drive for other uses—particularly handy if you have only a single CD-ROM drive in a system; you can play music or burn other CDs simultaneously while using Knoppix.

The toram cheat code instructs Knoppix, before it does anything else, to create a large ramdisk and copy the complete CD there. A ramdiskis a virtual hard disk that your operating system creates by setting aside a certain amount of your RAM. When you boot with this cheat code, Knoppix warns you that it might take some time to copy the full image and provides a progress bar while the image is copying. The Knoppix CD image is approximately 700 MB by itself, so this option is only for those of you with 1 GB or more RAM in your system, because even after copying the CD to RAM, Knoppix still needs a good portion of the RAM for loading applications and writing temporary files. If Knoppix runs out of space to copy, it alerts you that it ran out of space and cannot complete the copy and drops back to loading directly from the CD-ROM.

If you don't happen to have over a gigabyte of RAM in your system, you can still free up your CD-ROM drive by using the tohd cheat code. Similar to the toram cheat code, this cheat code copies the complete CD image to a partition on your hard drive. This partition can be almost any filesystem that the Knoppix supports, including Windows filesystems such as FAT and FAT32. NTFS (the default filesystem for Windows 2000 and Windows XP) cannot be written to directly, and it will not work with the tohd cheat code. This cheat code expects you to pick the partition using Linux device names, so if you want to use the first partition on your Primary IDE hard drive, type:

tohd=/dev/hda1

If you are unsure which device name to use, simply boot Knoppix from the CD and make note of the names on the hard-drive icons on your desktop. You can use any one of these devices that has enough available space. As with the toram cheat code, tohd requires you to have over 700 MB free on your partition. Knoppix copies its CD image into a directory called knoppix at the root of the partition that you specify.

One advantage to using the tohd cheat code is that the knoppix directory it copies is not deleted when you reboot. In subsequent boots, you can reference the already copied image by using the fromhd cheat code. So, if you have previously used the cheat code tohd=/dev/hda1 on a computer, type this command to use the same image again:

fromhd=/dev/hda1

You can even just type fromhd without any arguments, and Knoppix scans the hard-drive partitions for you.

Boot from a CD Image

A new feature in Knoppix 3.4 is the bootfrom cheat code. With this option, instead of a CD, you can choose an ISO image you currently have on your hard drive for Knoppix to run from. While similar to the fromhd cheat code, bootfrom uses an actual Knoppix ISO that you must already have on your hard drive. One stipulation for this cheat code is that the ISO you choose must have the same kernel version as the CD-ROM you are using to boot. There are different ways to check the kernel version, but probably one of the best ways is to go to a Knoppix mirror and download the KNOPPIX-CHANGELOG.txt file. This file lists all of the major changes in each Knoppix release and usually lists the kernel versions for each release. Otherwise, to quickly check the kernel version from within Knoppix itself, run the following command in a terminal:

knoppix@ttyp0[knoppix]$ uname -r
2.4.26

To boot from an ISO, type bootfrom followed by the full path to the ISO file. The bootfrom cheat code expects the same Linux paths as tohd and fromhd, so if you have Knoppix.iso in the root directory on your Primary IDE hard drive, type:

bootfrom=/dev/hda1/Knoppix.iso

The bootfrom cheat code is particularly useful if you are customizing Knoppix , as you can have multiple ISOs in a single directory and choose between any of them at boot time. This cheat loads from an ISO and not directly from a CD, so you aren't restricted by the 700 MB capacity limit of a CD-ROM. If you are modifying your own Knoppix-based distribution and are having a difficult time squeezing it all within 700 MB, test your images directly from the ISO without having to worry about the CD size requirements.

After you boot off of the stored image, the Knoppix CD no longer needs to be mounted, so you can eject it and use the CD-ROM for other tasks. You can also use these cheat codes as an intermediate step before fully installing Knoppix to your hard drive; though most of the system files will be read-only, you still benefit from the speed of a full hard-drive install.


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.