PDA

View Full Version : Run KNOPPIX fast! w/o touching Windows partitions



eco2geek
09-13-2003, 06:42 AM
Purpose:
Run KNOPPIX off the hard drive, which is much faster than running it off of the CD-ROM, without having to repartition the drive or learn how to use boot loaders.

Note:
This only works if you can boot to a DOS prompt, meaning you've got to be running DOS/Win3.x or Win9x. (Untested: This might work if you have Win2K/XP installed on a FAT32 partition, and boot from a Win98 boot disk, but I don't know.)

Credit for idea goes to:
http://www.knoppix.net/docs/index.php/HdBasedHowTo

What you need:
WinImage (http://www.winimage.com)
LOADLIN (ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/update-1.6c)
(The LOADLIN docs are available in the full archive in the parent directory)
A zip extractor such as WinZip (http://www.winzip.com)
Knoppix, burned to a CD-ROM
700+ MB free hard drive space
Knowledge of the "cheat-codes" you need to run Knoppix

HOW-TO:
1. Make a directory on your drive, say, C:\knoppix

2. Copy the ~700MB file X:\KNOPPIX\KNOPPIX (where X: is your CD-ROM drive) to C:\knoppix.

3. Use WinImage to open the X:\KNOPPIX\boot.img file (where X: is your CD-ROM drive). Extract the files "vmlinuz" and "miniroot.gz" to C:\knoppix.

4. Extract loadlin.exe (from the "loadlin.exe.gz" archive) to C:\knoppix (e.g. using WinZip).

5. Create a batch file, named something like "knoppix.bat", in C:\knoppix, containing:

rem Batch file to boot the KNOPPIX image from the hard drive using LOADLIN.
rem Put your Knoppix "cheat-codes" after the "ro" statement.
rem This batch file assumes you are running it from the same dir that
rem "vmlinuz" and "miniroot.gz" are saved in.
rem
loadlin vmlinuz root=/dev/hda1 initrd=miniroot.gz ro

(You don't need to include any of the lines beginning with "rem".)

6. Put the "cheat-codes" (see "knoppix-cheatcodes.txt" on your Knoppix CD) after the "ro" statement. For example, my loadlin command reads:

loadlin vmlinuz root=/dev/hdb1 initrd=miniroot.gz ro 2 lang=us keyboard=us wheelmouse nousb home=/dev/hda1 myconfig=/dev/hdb2

(I use "2" to start Knoppix in text mode, because when run from the hard drive it sometimes has a hard time starting X windows automatically; and "nousb" to turn off probing for USB hardware, which has made Knoppix hang in the past.)

7. Boot to a DOS prompt. (In Win9x, you can use the "TweakUI" control panel, if you have it, to "always show boot menu," or you can press F8 when the computer displays "Starting Windows..." to bring up a boot menu.) Navigate to C:\knoppix, and type "knoppix" to run the batch file. The kernel will load, and Knoppix will find itself on your hard disk, and continue normally.

Limitations:
Knoppix thinks the partition you ran it from is the CD-ROM, even though it's not. Consequently, you won't be able to access your CD-ROM drive (at least, I can't - I haven't found a way to mount mine when running from the hard disk, and I have two of them).

Also, as far as configuration, persistent home directory, and swap files go, Knoppix will only use one partition for one of the above (even when run from CD). Meaning, you can't save your persistent home dir and your config files to the same partition. Now, when you run Knoppix off a partition, that means you can't load config files, a home dir, or a swap file from it. In my case, it doesn't matter, since I've got four partitions to play with, but for those with only one partition, you'll probably have to save/load your config files to/from a floppy.

Tested with:
Knoppix v3.2-2003-09-05-EN

Question:
Does it make any difference what "root=" is set to?

baldyeti
09-13-2003, 11:24 AM
One thing I'd like to add is one should try to retain as
many of the default knoppix boot parameters as possible,
(eg scsi emulation for cd writers...) which can lead to long
invocations of loadlin that are silently being truncated.
It's thus best to use a parameter file, as described here:
http://www.knoppix.net/forum/viewtopic.php?t=2273#10660

This thread essentially exposes the same method, but focuses
on building a fast boot diskette without altering the HD boot
logic at all. Another nice and flexible method involves win32grub
(see posts by garyng), but alas this too seems to fail with NTFS.

To answer one of your questions, I don't think the root parameter
matters at all in this case. Actually my loadlin parameter
file does not have one and still works fine.

Also, the batch file is not strictly necessary, but your
config.sys file (if your dos/windows has one), can have an
entry similar to "Shell=C:\loadlin.exe @C:\knx.par" in a
knoppix section.

Finally winiso is not really needed, one can get the kernel
and miniroot file using one of the following 2 methods:
1) create a boot floopy using "mkfloppy.bat"
2) from the live CD, issue
mkdir/tmp/F
mount /cdrom/KNOPPIX/boot.img /tmp/F -o loop
then copy the files from /tmp/F to your FAT partition

bv1al
09-14-2003, 01:53 AM
My doing is modify the file "linuxrc" inside the "miniroot.gz" inside "boot.img"

original:
DEVICES="/dev/hd?"
test -n "$FOUND_SCSI" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
DEVICES="$DEVICES /dev/pcd?"

modified:
DEVICES="/dev/hd?"
case "$CMDLINE" in *sysonhd*)
;;
*)
test -n "$FOUND_SCSI" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
DEVICES="$DEVICES /dev/pcd?"
;;
esac

This means if an options "sysonhd" was found on booting command, then
skip searching KNOPPIX on CDROM, and search KNOPPIX on HD.
("sysonhd" means "system on harddisk")

then save this, replace old "boot.img"

then booting KNOPPIX on HD without floppy, without loadlin, without any
other boot-loader but just useing the same KNOPPIX CD.

when booting from CDROM, useing "sysonhd" as an option
after "Uncompressing linux ......." it then search KNOPPIX on HD, skip
searching from CDROM.

then you can remove CD when KNOPPIX is running on HD.

I have made an "boot-tw.img" with this modification and some others for
my personal preference here:
ftp://cle.linux.org.tw/pub2/KNOPPIX/bv1al/
but this is for my TAIWAN's version only.

eco2geek
09-14-2003, 09:10 AM
Above I said that Knoppix couldn't see my CD-ROM drives when running it this way (I assumed it was because it mounted the drive Knoppix is running from as /cdrom).

Turns out this is not the case. If you want Knoppix to recognize your CD-ROM drives, you simply have to have CD's in the drives when you start Knoppix.

Fabianx
09-14-2003, 10:10 PM
My doing is modify the file "linuxrc" inside the "miniroot.gz" inside "boot.img"

original:
DEVICES="/dev/hd?"
test -n "$FOUND_SCSI" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
DEVICES="$DEVICES /dev/pcd?"

modified:
DEVICES="/dev/hd?"
case "$CMDLINE" in *sysonhd*)
;;
*)
test -n "$FOUND_SCSI" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
DEVICES="$DEVICES /dev/pcd?"
;;
esac

This means if an options "sysonhd" was found on booting command, then
skip searching KNOPPIX on CDROM, and search KNOPPIX on HD.
("sysonhd" means "system on harddisk")

then save this, replace old "boot.img"

then booting KNOPPIX on HD without floppy, without loadlin, without any
other boot-loader but just useing the same KNOPPIX CD.

when booting from CDROM, useing "sysonhd" as an option
after "Uncompressing linux ......." it then search KNOPPIX on HD, skip
searching from CDROM.

then you can remove CD when KNOPPIX is running on HD.

I have made an "boot-tw.img" with this modification and some others for
my personal preference here:
ftp://cle.linux.org.tw/pub2/KNOPPIX/bv1al/
but this is for my TAIWAN's version only.

You are late ;-).

This is already on in official knoppix as "fromhd".

So no need to remaster ...

cu

Fabian