This manual is updated frequently as I’ve found something useful to note for friends and myself.
0). For a newbie. 1). Optimal man HD install. 2). Multi-booting, not-bootable cd drive. 3). Be full ROOT. 4). Resizing winxp hard drive – ntfsresize. 5). Compact winxp sp2 installation. 6). Captive-ntfs, writing to winxp ntfs. 7). Optimal hd partitioning. 8 ). Custom programs installation to "knoppix core". 9). HD and Knoppix-3.8 UnionFS. 10). Full control for knoppix initiation.
EXHIBIT A: Video settings adjustment . Quick tips. Slipstream sp2 to winxp cd. Examples of the customized knoppix.sh and /etc/profile

0. For a newbie
Look at the top of this screen and “Get Knoppix” as FREE ~700 MB KNOPPIXxxx.iso cd image. Next, burn knoppix bootable cd using: “burn cd from saved iso image ” option in a cd burning software like Nero (5 days trail is here http://ww2.nero.com/us/index.html , but freeware CDBurnerXP Pro http://www.cdburnerxp.se does the same job well); winxp does not offer such opportunity, but JohnPipe found a small plugin http://isorecorder.alexfeinman.com/isorecorder.htm that allows winxp to burn cd from an iso image without any special software.
Your OS may show 698 or 715…, but these are simply different units (see “Quick Tips”) of the same iso file which can be burned to a standard 700 MB cd.

The follow managers provide smoothly, multy-chanels, resumed after a break download, and you can get the cd image even with a dialup connection (in ~2 days): http://www.metaproducts.com/mp/mpPro...tail.asp?id=18 ; http://www.freedownloadmanager.org . If you prefer/forced to use BitTorrent (good for fast, but bad for slow connection), this agent http://www.bittornado.com/download.html works better than the original BitTorrent.

You can boot and run Knoppix completely from CD without any hard drive (hd), but slow and keep cd drive busy; or make full hd installation, and next completely reinstall knoppix after a new version release. But knoppix generosity is ability to use without a big mess . But down side is a problem with personal settings saving and programs installation.

Cheat code home=/dev/... creates /dev/.../home/knoppix at each boot. At persistence home you should set size of a filesystem image without knowledge how big it will be, and it is not convenient to work with filesystem image, especially to make emergency corrections from other booted Linux, e.g., rescued live Knoppix cd.

Not convinced, consider this. You need at least 2.5 GB partition to make hd installation. OK, not big deal today, but if you have a modern hd, you have a modern pc, and knoppix without big clutter runs from core just fine on modern pc. So, "poor man install" should be called "rich man install"; but if you have a slow pc you may consider full hd installation to speed up performance.

Optimal way is to copy personal and configuration files to hd and connect they to knoppix root / at each boot; your changing will be saved on hd immediately and will NOT disappear at knoppix reboot.

1. Optimal man HD install
User knoppix has permission to work only in home directory /ramdisk/home/knoppix, and you should be root (see below) to make changing in other place.

Run live knoppix cd; use cfdisk or qtparted in KDE to make Linux partition with minimum 730 MB. If you have only one ntfs partition, use ntfsresize (see below) to resize hd.

Partition Placement: Modern hard disks use zoned bit recording ( http://www.storagereview.com/guide20...tracksZBR.html ), which means they hold more data per track at the outermost edge of the disk than they do at the innermost edge; as a result, the outer tracks tend to deliver better performance than the inner tracks do. Since the outer tracks are used first, this means that the first partition on a physical disk volume will be faster than subsequent ones. If you have certain files that require higher performance than others, placing them in a partition at the beginning of the disk is preferred.

I place only knoppix core and /boot files in 730 MB /dev/hda2, the second fastest partition after only 3 GB (see below) the first fastest winxp partition; and make ext2 file system with bigger cluster size (majority CPU read 4096 blocks), large file support, and without reservation for super user:
mke2fs /dev/hda2 -F -m 0 -T largefile4

You can easily do many operations in the Midnight Commander ( mc ) or kde desktop, but text commands are presented for better understanding and to encourage using small scripts which make Linux live a little bit easy.

Copy from knoppix cdrom to hd:
===========================
mkdir -p /mypat
mount -t ext2 /dev/hda2 /mypat -o rw,exec
mkdir -p /mypat/KNOPPIX /mypat/boot
cp -a /cdrom/KNOPPIX/KNOPPIX /mypat/KNOPPIX
cp -a /cdrom/boot/isolinux/{linux26,minirt26.gz} /mypat/boot/
cp -a /ramdisk /mypat ; # Actually, you don’t need to copy /ramdisk now as at the first Knoppix boot with my knoppix.sh and/or modified linuxrc, /home /tmp /ramdisk (and /etc /var for k37) will be moved to hd, and next, you can boot Knoppix either from hd or cd using saved on hd in /mypat directories.
===========================

Make lilo.conf something like this:
===========================
boot=/dev/hda2
# So, Lilo will be installed to /dev/hda2 mbr, not disturbing main hda MBR
default=kn26fromh2
delay=300
vga=788
map=/boot/maphda2

image=/boot/linux26
label=kn26fromh2
initrd=/boot/minirt26.gz
append=" fromhd=/dev/hda2 mypat=/cdrom k38 myconfig=scan ramdisk_size=100000 init=/etc/init quiet dma "

# All rest pointed in the next append "... " for fc3rt is optional.
# When you reboot knoppix from hd, this hd partition will be mounted as /cdrom. So, if you want to place your files to this partition you should point to it as mypat=/cdrom. I prefer to use the next formatted for small files /dev/hda3 partition and set mypat=/dev/hda3 ; my knoppix.sh or lunixrc will mount it as /mypat. In addition to setting Knoppix version k37 k38 and rmd also give different $mdr/ramdisk$kn names and you can alternately boot different or the same Knoppix to different directories.
# Anything passed to kernel as X=y became global (type env to see) and can be used anywhere as e.,g.: z=$X
# Press Alt to see boot menu when you see LILO 22.6.1 boot line

# 40 MB base Linux (10 MB in fc3rt.gz) combined from the last Fedora Core 3, which I boot to RAM, incl., to fix Knoppix boot or hd filesystem problem
image=/boot/linux26
label=fc3rt
initrd=/boot/fc3rt.gz
root=/dev/ram0
append=" init=/etc/init ramdisk_size=100000 nomce vsync=56 lang=us quiet dma noeject noprompt 2 nofirewire nopcmcia nodhcp noscsi nousb noapm noddc nosound noaudio noswap "
# apm=power-off acpi=force apic=force nodma noagp noapic wheelmouse fb800x600 screen=800x600 xmodule=fb xmodule=vesa 2

image=/boot/memtest86+-1.51.bin
label=memtest
==========================

Next, continue running live Knoppix cd :
==========================
[ -h /boot ] && unlink /boot ; mkdir -p /boot
mount –bind /mypat/boot /boot
# You can run lilo if /etc/lilo.conf ; but I don't understand why lilo looks for /etc/lilo.conf, it would be better to keep it in /boot/lilo.conf; so for now run:
lilo -C /boot/lilo.conf -P ignore ; # -P ignore ~to ignore partition table, but only when run Lilo from knoppix cd; re-run Lilo after booting knoppix from hd
# look inside /boot ; as we mount --bind /mypat/boot /boot you'll see files from /mypat/boot
==========================

Next, find the kde desktop penguin icon and save knoppix configuration to /dev/hda2. Move configs.tbz to other place, e.g., /mypat/boot and floppy as your emergency settings restoration. Do this periodically, but better to other partition or a floppy; at least, don't replace and loose your customized knoppix.sh .

Next, copy the knoppix.sh script from the EXHIBIT A to the /mypat/knoppix.sh .

2. Multi-booting, not-bootable cd drive
Now you can boot knoppix from hd. But before do this visit http://btmgr.sourceforge.net/download.html and install simple Smart Boot Manager. This tiny program doesn't touch any mbr, and be installed in the sector even before hd MBR, or you can install and use it from a floppy (of course, slow, but good for emergency). You can also use XOSL, but it requires an additional partition. Normally, a boot manager can also boot cd drives that are NOT-BOOTABLE by bios .

At boot, Smart Boot Manager presents a screen with pc devices having bootable sectors. Choose: "NTFS Primary 1" to boot winxp from /dev/hda1, or "Linux Primary 2", and get Knoppix, which will boot and run farter from native Linux partition. Reinstall Smart Boot Manager after a partition creating or deleting.

You can rename a file, e.g., linux26, or move it to any other directory within a partition, but Lilo still be able to find it, as it’ll reside on the same physical location changing only its path. But a partition defragmentation may move a file to another place, and Lilo should be re-running before rebooting, as previous Lilo would not find linux26.

You also can boot Linux from DOS. You need files: linux26, minirt26.gz, and loadlin.exe . The length of a DOS command line can be only 127 bytes. To pass more command to kernel simply use two _.bat files. The first with only one line: loadlin.exe @b-kn265.bat . It'll start the second b-kn265.bat where place line by line (very convenient to uncheck by placing # at a line beginning) all you want to pass to kernel (see lilo.conf above). But this is legacy very very slow method, and I keep it for any emergency).

You can also boot Linux from winxp boot.ini. After running Lilo, copy Linux partition boot sector to a file dd if=/dev/hda2 of=/d/b-h2 bs=512 count=1 and place b-h2 file to the winxp boot partition, and include in the boot.ini menu this line: c:\b-h2="c:\b-h2 - booting Linux from /dev/hda2" (I boot ntfs winxp from vfat partition which in winxp became d:\ and I mount it in Linux as /d, but at boot time for boot.ini it’s c:\ ).

It’s convenient and simple way without a fear to destroy mbr, but down side is you should do this each time after running Lilo. With custom functions and alias’s from my /profile I do this in 10 seconds using: lil ; mn d ; ddd . If forgot you always can boot Knoppix from cd and correct boot problem.

3. Be full ROOT
Want to be full root? Just press CntrAltF2 (or F3, F4) and use command Linux where you are root and can do anything. Type mc and have powerful file manager. At any time press AltFn (or CntrAltFn in KDE) to use other terminals: default F1~ starting X-KDE session, F2 - F4 ~ text terminal, F5 is reserved for KDE.

Still don't like, click on the black screen icon to open KDE terminal, type su , press Enter , next type init 2 . You'll be dropped in the text Linux where you'll be root. Press AltF1 and wait when X-session will be closed, periodically pressing Enter . Next just type startx and you'll be a desktop King, sorry root, again. But,…………………………… as all Kings be ready for assassin through net security hole. So, be caution to use root, better short time, and better without Internet connection.

Root is a new user with new settings. If you want to use your previous settings, delete files from /ramdisk/home/root and copy there files from /ramdisk/home/knoppix . Do this in the text terminal ( mc ); next, re-login as root again. Root can use alien files, but knoppix not. After root is done, type in terminal init 2 again, and from text Linux terminal type init 5 to start desktop as user knoppix.

Above was about full root, but for quick easy temporary root during kde session, open kde terminal, type su , press Enter , type mc and use powerful file manager where you can create, delete, copy, move, edit, change permissions, link, unlink, see sizes of files and directories, install programs, and much much more.

4. Resizing winxp hard drive – ntfsresize
Ok, if you have only one ntfs partition use ntfsresize (or qtparted in KDE) to resize ntfs file system, and next, cfdisk to adjust ntfs partition size and make a new partition for Linux. If there are unmovable, e.g., pagefile.sys files (run winxp disk defragmenter to see this) on place you want to free for a new partition, remove these files before resizing.

Keep in mind that ntfsresize changes only ntfs file system size, but not partition size-table. Better understanding ntfsresize using looks like moving a fence to change your property boundary, and moving all your property inside new boundary. But a land developer still has old map, and you may be in trouble. So, you need to use cfdisk to adjust new map (partition table). Again, be caution with new boundary. Let say, you decrease ntfs file system to 5000 MB from the disk beginning, and it would be safer to mapping in cfdisk as 5005 MB.

Actually, 5 GB size may be optimal for the first ntfs partition, enough to keep winxp and Program Files, but easy to keep winxp system partition clean, in good condition, incl., faster defragmenting. All rest would be better to place on other storage partition, especially Encyclopedia with a lot of small files.

I keep winxp xp2 (~600 MB after full installation and updates but without obsolete files and backup’s), pagefile.sys, and Program Files on 3 GB partition, including at least 800 MB free for system expansion; and also keep pagefile in optimal position close to winxp system files.

5. Compact winxp sp2 installation:
If you have winxp sp1 cd, it’s better to slipstream sp2 and hotfixes to winxp cd and make a new sp2 installation.
Again, in “Quick Tips” the sp2 slipstream procedure is described in details, but of course, the simplest way is using freeware such as nLite http://nuhi.msfn.org to slipstream sp2 and the hotfixes to winxp, make the iso cd image, and burn it, e.g., by mentioned above CDBurnerXP. More important, nLite can remove from winxp cd many components, e.g., Tour, Winplayer, MSN, Messenger, drivers, which in any case became obsolete and you download the latest versions.

Minimum requirement for a fresh winxp installation is 1033 MB for sp1 and 1201 MB for sp2 (1160 MB for win2003), but nLite can also remove restrictions for minimum ram and disk space requirements. Just for fan, I stripped winxp distribution folder with slipstreamed xp2 and latest hotfixes to 215 MB and installed winxp to 600 MB partition with c:\windows directory as 452 MB, 3131 files, and after removing some files 385 MB, 2868 files. The installation works perfectly.

By the way, the easiest and painless (of course, if enough RAM to share) way to play with different OS is using “Microsoft Virtual Machine” (download 45 days trail from Microsoft). Without leaving the host OS, or the pc rebooting, VM can install, run, or reboot several different Operation systems simultaneously. Also, it’s convenient for testing, as you can make installation directly from the iso cd image without actual cd burning. If something goes wrong, simply change winxp installation folder, create another iso image, and continue installation without the pc rebooting.

For a normal installation I use a trick by placing, e.g., an empty file by dd Linux command, to fill all but ~700 MB on the partition before fresh winxp installation (if you don’t have formatted partition, start installation, format partition, and stop installation when files coping are started. Next reboot to other OS, dos if fat32 or Linux if ntfs, remove or rename copied and add additional files).

In this case winxp does not copy C:\windows\system32\dllcache and other “junk” with winxp installed as 526 MB and 4331 files. Next, remove temporary files, install hardware drivers and delete c:\windows\Driver Cache\i386 (you always can install drivers from cd), c:\windows\Help\Tour, compress rare used c:\windows\inf and get winxp sp2 installed as ~430 MB. Move MyDoc to a storage partition that also protects it in the case of more much likely system partition crash.

If pagefile is fragmented or placed far from the partition beginning, set pagefile = No at system partition, reboot, I prefer to Linux to use simple script to delete a huge amount never used files such as sound, video, pictures, html, help (do this periodically, you also may do this less effective using winxp "Search"), and get ~400 MB winxp and ~30 MB initial Program Files. After each update remove c:\windows\$…… files.

Next, reboot to winxp and: Start\Run rundll32.exe advapi32.dll,ProcessIdleTasks to line up windows startup files; next run disk defragmenter to compact remaining files. When winxp files will be all together (startup files as a second remote bunch), set reasonable (~1.5xRAM size) pagefile, it should be placed close to winxp files, and make rest installation next (2-4 pagefile fragments is not bad, especially, if they are scattered between installed files, repeat operation if the initial pagefile was placed not close to winxp files).

Unmovable initial pagefile will stay in optimal position between system and programs files that reduce hard disk magnetic heads tossing improving system performance . Of course, if you have several hard disks, it would be sense to place pagefile on other physical disk allowing simultaneously reading from one disk and writing to another. The same situation is with Linux and swap.img .

6. Captive-ntfs, writing to winxp ntfs
To write to ntfs I run the simple script without using any other programs . If settings are saved on hd, you need to run this script once, and only mount ntfs next. This script is included in " mn ntfs " function in my /profile, or copy this script to, e.g., cptv file and make it executable ( chmod 777 cptv ).
============================
#!/bin/bash
mkdir -p /c ;
for i in ntfs.sys cdfs.sys fastfat.sys ntoskrnl.exe ; do
find $1 -iname $i | xargs --replace cp -f {} /var/lib/captive ; done
cpar="/bin/cp -a --remove-destination --reply=yes"
[ -h /etc/group ] && unlink /etc/group # checking if it is real file, not link
[ -f /etc/group ] || $cpar /KNOPPIX/etc/group /etc/ ;
echo "captive:101" >> /etc/group
[ -h /etc/gshadow ] && unlink /etc/gshadow
[ -f /etc/gshadow ] || $cpar /KNOPPIX/etc/gshadow /etc/
echo "captive:*::" >> /etc/gshadow ;
useradd -g captive -d /var/lib/captive captive ;
mount -t captive-ntfs /dev/hda1 /c ; #Don't mount captive-ntfs on /mnt/hdxx
============================

Captive-ntfs uses native NT-like Windows drivers, but does not work with drivers from winxp sp2 , win2003 Server and win2k. So, save cdfs.sys fastfat.sys ntfs.sys ntoskrnl.exe from winxp sp1, and run above script as e.g., : cptv /... ~where to look for saved drivers, or cptv /mnt/hda1/windows/system32 ~only sp1, if ntfs is mounted on /mnt/hda1.

If you already upgraded to winxp sp2, copy files from sp1 installation cd i386/ NTFS.SYS and CDFS.SY_ FASTFAT.SY_ NTOSKRNL.EX_ and unpack the last three, e.g., using winRAR, winZIP, or in Linux, e.g., cabextract CDFS.SY_ and copy they to /var/lib/captive .

Don’t move a big amount of data, mainly big number of files , without correct ntfs umounting. Changes on ntfs partition will be saved ONLY when: ALWAYS correctly run umount /c after moving enough files or before system resetting. This script works with Knoppix3.7-3.4, but captive-ntfs was removed from Knoppix3.8. So, boot Knoppix3.7 cd with my profile and knoppix.sh if you need to write to ntfs.

Next frequently asked question is with what OS captive-ntfs works? Captive-ntfs does not work with any OS; it works with ntfs file system. E.g., testing evaluation copies I simultaneously installed (in different folders: c:\winxp c:\win2k c:\win3s) and alternatively run from the same ntfs partition win2k Server, winxp, and win2003 Server. So, captive-ntfs can read/write to any these OS as they use the same ntfs (I'm not sure about winNT file system).

7. Optimal hd partitioning
Again, three steps to make a new partition: free space for a new partition ( cfdisk or ntfsresize ), make (mapping) a new partition ( cfdisk ), and make a file system in a new partition ( mke2fs ). When you set a partition size (e.g., in cfdisk ) its size may be changed automatically to even (to complete) the closest cylinder on your hd.

As mentioned above, the first hd partitions are faster, so make OS partitions smaller, and place they at the hd beginning. Another consideration: as the BIOS in some systems cannot access more than the first 1024 cylinders (~10 GB) on a hard drive ( cfdisk can show partitions size in different units, incl., cylinders) your bootable files should be within this limit.

I place my primary winxp (incl., pagefile.sys) 3 GB partition as /dev/hda1, next as /dev/hda2 only 730 MB Linux partition formatted with large files support (only 192 inodes, see below) with /KNOPPIX/KNOPPIX core and /boot directory; and next, close to knoppix core to reduce magnetic heads tossing, formatted for small files support 800 MB /dev/hda3 for $mdr, installed programs, and swap.img (see knoppix.sh how to make swap.img). All rest hd is as /dev/hda4 for storage, accessible from winxp and Linux. All 4 partitions are primary, bootable.

8. Custom programs installation to "knoppix core"
This section was written before UnionFS adoption, but I left it for information purposes.
Normally, custom programs are structured to install to /usr directory, which is blocked as read-only at knoppix running from core. But "optimal man" had another idea for natural program installation to "knoppix core". Before UnionFS I used might be fancy way to overwrite this accordingly with my nation worn saying: "If mountains do not go to Mohammed then Mohammed goes to mountains".

Have (or make) a file system with at least ~94000 inodes available. To check this, type df -m ~for disk space, and df -i ~for inodes available and used in mounted file systems. Each Linux file has its own inode, which is a special block with information about this file. 100000 inodes occupy ~12 MB of disk space. A new file can't be created if no free inode is available. I.e., you may meet situation when you copy files to a partition with a plenty of free space, but system says: "no free space"; simply no free inode is available.

Inodes are created at the file system formation. To change inodes numbers and size the file system should be re-formatted ( data will be lost ), e.g., by:
mke2fs /dev/hda3 -F -m 0 -N 100000 ; # use additional -n option for preliminary testing without actual formatting.

Next, at any knoppix session:
=========================
mkdir -p $mdr/add/usr
/bin/cp -as /KNOPPIX/usr/* $mdr/add/usr ; # recursively links all files from /KNOPPIX/usr to the real directory $mdr/add/usr
=========================

These 92800 links (~5 MB of disk space) occupy 92800 inodes, You can free inodes for future use by reducing number of links, e.g., by re-linking (as simply as pressing Cntr(x)-s in mc ) a directory as hole, one inode per a directory; but these directories will be closed for writing. E.g., only re-linking .../doc and .../man directories, number of links was reduced to ~61000.

Actually, you may create enough inodes and don't care about reducing, On the other hand, keep opened only $mdr/add/usr directories where your custom installation will go, checking a package content before installation. A binary package (deb, rpm) content may be checked by opening it (clicking on it in mc ); and simply copied to /… without actual package installation, only running post install scripts, if any are present.

Next, you can make normal installation to root / ==> /usr until your partition will be full, or all inodes will be used (you can delete unnecessary links, as mentioned above, or to limit linked files from the beginning as described below). No needs to correct PATH and LIB_PATH. Only, after a new installation I run my custom psinst function.

If any operation says " ..... no file ", copy real file from /KNOPPIX/.... and put it to $mdr to connect to / (of course, avoid conflicts before and after autoconfiguration settings files).

I made $mdr/add/usr directory and manually linked /KNOPPIX/usr/ directories as whole to $mdr/add/usr /, except of those my programs will install to. I spent ~5 minutes to link manually, and next, installed latest KOffice-1.3.5.2, and only 10989 inodes and 39 MB were occupied by $mdr.

EXHIBIT A script knoppix.sh includes automatically linking at boot your customized $mdr/add/usr to /usr . At reboot /usr will be umounted, and knoppix.sh will mount it automatically at the next boot.

You can "hard link" a directory by " mount --bind " or "soft link" by " ln -s ", or recursively link files from directories by " cp -as ". " mount --bind " refers to inode locations, but "soft links" to files path. Both have preferences: "mount --bind" does not use inodes and hd space, but if you accidentally delete directory all data will be lost. In the case of "soft links", only link will be deleted, but links add path for files searching and execution.

9. HD and Knoppix-3.8 UnionFS
Knoppix-3.8 adopted Union file system ( http://www.linuxjournal.com/article/7714 ) that recursively merges several underlying directories or branches into a single virtual view. Branches can be of any filesystem type, and each branch is assigned precedence. A branch with a higher precedence overrides a branch with a lower precedence. UnionFS keeps track of which files you have modified (which are modified and stored within the higher branch) and which are unmodified.

The above was a theory. How to adopt UnionFS to hd install? It’s look like the simplest is to remove /ramdisk from the union, umount it, and place your hd directory on the top of the /UNIONFS, keeping all changing’s in the hd directory. But Knoppix-3.8 adds /ramdisk to /UNIONFS in the minirt.gz/linuxrc that keeps /ramdisk busy next, you cannot umount it as it was possible in Knoppix3.7.

Therefore, you can only close /ramdisk for writing (--mode ro ) and add a hd directory on the union top. But each new UnionFS branch decreases a pc performance and, at least in my case, adding an ext2 hd directory on the top of the /ramdisk and /KNOPPIX frequently tends to “segmentation fault” with the filesystem damage.

Therefore, the simplest is to unlink /home and may become bulky /tmp from RAM based /ramdisk and to link they to a hd directory. Nevertheless, this will continue to “drain” your RAM and will not keep configuration settings after rebooting. Therefore, it is better to use modified linuxrc for adding mypat/ramdisk to /UNIONFS without a real ramdisk creation. This procedure is described in the next section. Read also manuals for unionfs and unionctl .

10. Full control for knoppix initiation
You need to modify and replace (see Quick Tips) linuxrc file inside minirt.gz to control early initiation process. I placed pointed below scripts to the linuxrc , and now through cheatcodes have full control of knoppix initiation: including saving configuration files changing’s directly (via UnionFS) to hd or usb stick based directories without inconvenient "persistence home" and a real ramdisk creation, run custom scripts automatically, or to interrupt linuxrc initiation and make changing manually. So, there is no difference to boot fully hd installed knoppix or "Optimal man" hd installed knoppix.

It’s better to start from the linuxrc end to keep line numbering before. Place two lines script between (together) with (#=====) to the Knoppix-3.8 linuxrc after the line 659:
Line 659: echo "${BLUE}Done.${NORMAL}"
#=============================
;; esac # The end of: case "$CMDLINE" in *mypat=/* )
case "$CMDLINE" in *run2*) runscrpt ;; esac
#=============================
Next should be line:
stage=2

Next, place the script together with (#=====) after the line 626:
Line 626: rm -rf /modules /static
#==============================
runscrpt() { echo ; # " Place this function in linuxrc before the first time using, and call it next as referred below in the "case ..." using the boot line cheatcode as a place to stop, e.g., run1 "
echo ">>>>> Hi, you are stopped inside linuxrc. As /KNOPPIX and /proc are already mounted, type /bin/bash to open a shell and use fully operational Linux, e.g., to place custom /etc/inittab, etc/init.d/rcS, or scripts to /etc/rcS.d/Sxxxx.sh to run at system initiation. You can use mounted fromhd ==> /cdrom, or mount any device. Next, umount devices and type exit until you leave all shells. In the linuxrc end you even can type mc and use powerful file manager."
echo ; echo "When you left bash shells, you still can run commands until type -ok- to continue linuxrc, or -exit- to leave it, as you are in the loop:"
echo ' until [ $srpt = ok ] ; do read srpt ; $srpt ; done '
srpt=55; until [ $srpt = ok ] ; do read srpt ; $srpt ; done ; } # The end of the runscrpt function

CMDLINE="$(cat /proc/cmdline)" ; case "$CMDLINE" in *run1* ) runscrpt ;; esac

# Using hd or usb stick based directories in UnionFS without a real ramdisk creation
case "$CMDLINE" in *mypat=/* ) mkdir -p /zyx ; # echo "This script runs if mypat=/... is set as a boot line cheatcode: mypat=/cdrom to use the same partition as fromhd=/... ; mypat=run to do anything manually here; or mypat=/dev/... to mount hd or usb stick based partition on /mypat. Set Knoppix version k38; you also can set mypat filesystem type, e.g., myfs=ext3 or ext2 will be used."
case "$CMDLINE" in *rmd*) kn=-rmd;; *k38new*) kn=-38new;; *k38*) kn=-38;; *k37*) kn=-37;; *) kn=-xx;; esac
case "$CMDLINE" in *mypat=/dev*) mdr=/mypat;; *mypat=/cdrom*) mdr=/cdrom;; esac
echo ; echo ">>>>> Hi, I am inside minirt.gz/linuxrc before (re)mounting $mypat ==> $mdr for adding $mdr/ramdisk$kn to /UNIONFS without a real ramdisk creation. "

echo ; case "$CMDLINE" in *fromhd=/* ) echo ">>>>> fromhd=$fromhd is mounted at /cdrom as ro; you may say Yes to check it and remount,rw "
fst=ext2 ; if [ $fst = ext2 ] ; then /KNOPPIX/sbin/e2fsck -p $fromhd ; fi
/KNOPPIX/bin/mount $fromhd -t $fst /cdrom -o remount,rw,exec && echo ">>>>> (Re)mount: $fromhd -t $fst /cdrom -o remount,rw,exec";; esac

echo ; mdr=ZZZ ; case "$CMDLINE" in *myfs=* ) fst=$myfs ;; * ) fst=ext2 ;; esac
case "$CMDLINE" in *mypat=run* ) runscrpt ;; # You should set mdr=/....
*mypat=/dev/* ) echo ">>>>> Mounting partition: mypat=$mypat ............"
if [ $fst = ext2 ] ; then /KNOPPIX/sbin/e2fsck -p $mypat ; fi
[ -d /mypat ] || mkdir -p /mypat ; [ -d /mypat ] && mdrp=/mypat ;
if /KNOPPIX/bin/mount $mypat -t $fst $mdrp -o rw,exec ; then mdr=$mdrp ;
echo ">>>>> $mypat is mounted as: mount $mypat -t $fst $mdr -o rw,exec " ;
else echo ">>>>> $mypat is not !!!!!!!!!!! mounted as: mount $mypat -t $fst $mdrp -o rw,exec"; fi ;;
*mypat=/cdrom* ) mdr=/cdrom ;; esac

[ -d $mdr ] || { echo 'No valid $mdr directory was found. Reboot and set mypat=/... as the boot line cheatcode, or enter directory where you saved (or would save) and use hd based $mdr/ramdisk$kn ==> /ramdisk '
read mdr ; echo "You entered: mdr=$mdr" ; sleep 2 ; }

[ -d $mdr/ramdisk$kn ] || mkdir -p $mdr/ramdisk$kn ; [ -d $mdr/ramdisk$kn ] && rmd=$mdr/ramdisk$kn

if echo "Hi, world" > $rmd/zt 2>/dev/null ; then rm -f $rmd/zt 2>/dev/null
echo ">>>>> Your writable ramdisk is: rmd=$rmd "
[ -d $rmd/home/knoppix ] || mkdir -p $rmd/home/knoppix
[ -d $rmd/home/knoppix ] && chown knoppix.knoppix $rmd/home/knoppix ; ln -sf $rmd/home /home
[ -d $rmd/tmp ] || mkdir -p $rmd/tmp ; chmod 1777 $rmd/tmp
[ -d /tmp ] && rm -fR /tmp 2>/dev/null && ln -sf $rmd/tmp /tmp
ln -sf $rmd /ramdisk
else echo ">>>>> Your ramdisk rmd=$rmd is not writable !!!!!!!!!!!!!!!!!! " ; fi
;; * ) # Continue of the: case "$CMDLINE" in *mypat=/* )
#=============================

Next should be line:
#New in Kernel 2.4.x: tmpfs with variable ramdisk size.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Now, at each knoppix boot, customized and saved on hd files are automatically bound to knoppix /dev/root/ and knoppix runs as previously session continuation. No needs in cd re-mastering. Personal settings (not storage, or installed programs) and presented here scripts are floppy size and can be moved with knoppix cd to other pc to continue your knoppix session.

No needs to burn a new version cd, simply download a new iso file, mount it and replace linux, minirt.gz and /KNOPPIX/KNOPPIX.

To make additional customization, simply copy real configuration file from /KNOPPIX/.... , modify it and place to your $mdr to automatically use at boot (or manually anytime). Any customization may be added to knoppix.sh script, which is called in the sequence: Linux init > /etc/inittabb > /etc/init.d/rcS > /etc/init.d/knoppix-autoconfig; the last calls knoppix.sh at the end of system autoconfiguration, but before entering into runlevel.

EXHIBIT A
Video settings adjustment
To adjust video settings open run and type: kxconfig , change settings, quit, and logout\in without rebooting (or simply press CntrAltBackspace ). If the kde screen is unreadable, open an other terminal ( CntrAltF2 ) , type kxconfig , correct settings, quit, return to the kde terminal ( AltF5 - 8 ) and press CntrAltBackspace .

Quick tips:
Open a script text in mc editor ( F4 ); if no, place #!/bin/sh as the very first line, close editor, open the script again. Script commands will be colored making it easy to read and understand. Use Shift-arrow_keys to highlight text, CntrIns to copy, AltDel to cut, and AltIns to paste text from clipboard.

If you copy a script in windows or dos, convert it to Linux: dos2unix script . Some editors may incorrectly transfer or even interpret the same symbol on a screen like \ “” ‘’ `` . Check converted colored script for black spots (black strings between `……` and ^[ are ok), and replace all \ in any line end.

Auto completion or don't know correct command name: Type in terminal any command beginning, quickly click two times Tab (in mc keep Alt and click Tab ), a command will be completed, or you'll see the list of commands to choose from.

Don't know how to use a command? Type command_name --help ; or man command_name ; or better in mc : press F2 , choose View Manual submenu, type command_name, read colored manual in convenience. It’s a very good idea immediately after this manual start to read: man bash that should help you to understand scripts.

698 MB or 715,….. KB
bytes/1000=Kb/1000=Mb/1000=Gb … , but
bytes/1024=KB/1024=MB/1024=GB …
Manufactures often use this delusion to show the maximum number, but not those used by majority OS. So, don’t be surprised when you got a new hd, but next discovered that it has less capacity than a vendor promoted.

Replacing linuxrc in the minirt.gz
gunzip minirt.gz ; mkdir /lop && mount –t ext2 minirt /lop –o loop ; open /lop, replace linuxrc, leave /lop; gzip –9 minirt ; done. With my /profile I do this in 20 seconds keeping pointer on minirt in mc : mk gu CntrEnter ; mn l /lop CntrEnter; replace linuxrc ; mn u /lop ; mk g CntrEnter ; done.

Slipstream sp2 to winxp cd
First, you need to get the entire sp2 file from Microsoft. To slipstream sp2 to a new winxp cd copy the winxp cd to hd, e.g., to c:\xp; extract sp2 ( c:\WindowsXP-KB835935-SP2-ENU.exe –x ), it’ll ask where - to c:\xsp2; and slipstream sp2 ( c:\xsp2\i386\Update\Update.exe -S:C:\xp ). You can also slipstream together with sp2 updates after sp2 (e.g., c:\WindowsXP-KB885835-x86-ENU.exe /integrate:c:\xp /norestart /n ). The last command also may be used to slipstream sp2.

You need to extract from winxp cd the boot image file “ Microsoft Corporation.img ”, e.g., using ISO Buster http://www.smart-projects.net ; and use it during new winxp cd burning to make it bootable. Detailed information may be found here http://www.theeldergeek.com

If you want to reduce installation folder, e.g., to place on the same cd additional files, run from any windows:
E:\i386\winnt32 /s:E:\i386 /unattend5:c:\winnt.txt /tempdrive:c /noreboot
or from dos: E:\i386\winnt /s:E:\i386 /u:A:\winnt.sif /t:d

Suppose, E:\ is your winxp installation cd drive, and unattended winnt.sif file is optional. This procedure creates on the drive /t:d two temporary folders with the only essential for installation files. Don’t continue installation, but rename folder with \i386 to, e.g., c:\xp\i386 and move to \i386 all files from the second folder. Next, copy from the installation cd: all root files only to c:\xp, and recursively from cd\i386\ files: disk1 , dosnet.inf , setupreg.hiv , usetup.exe , and all files started from: winnt*; and after sp2 slipstream: \i386\WINNTUPG\netmap.inf .

Remove from xp/i386 bootsect.dat , migrate.inf , and can remove or leave winnt.sif , at least, be sure that in winnt.sif : LocalSourceOnCD="1" if install from cd (iso image) and 0 if from hd. Next, you can slipstream sp2 and hotfixes to this “stripped” winxp installation folder, incl., removing unnecessary components. In my case the final sp2 winxp distributive folder is 263 MB, and I burned only one cd with all my installation programs.

Useful winxp freeware tools: http://www.met.com.tw/eng/download/d...o%20buster.htm ; http://www.majorgeeks.comhttp://www.optimizememory.com ; http://www.hoverdesk.net/freeware.htm ; http://personal.inet.fi/business/toniarts/ecleane.htm ; http://www.thefreecountry.com
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

knoppix.sh
It replaces RAM based /ramdisk and /etc with hd based directories for Knoppix3.7 and /home /tmp for Knoppix3.8. Set boot line cheatcodes: k38 or k37, mypat=/..., myfs=…(see above in linuxrc modification). Copy the follow script to the beginning, but after the very first #!/bin/sh line of the knoppix.sh :
#===========================
# home=scan >knoppix.img, next myconfig=scan >knoppix.sh run from /etc/rcS.d/S00knoppix-autoconfig
cpaur="/bin/cp -au --remove-destination --reply=yes" ; cpasr="/bin/cp -as --remove-destination --reply=yes"
echo; CMDLINE=`(cat /proc/cmdline)` ; echo -n '>>>>> The follow was sent to Kernel: ' ; echo $CMDLINE

case "$CMDLINE" in *fromhd=/* ) echo ; # Test fromhd ==> /cdrom partition for ro/rw and remount,rw. "Say " Yes " to check filesystem; e2fsck -y -p options should skip confirmation but done not work here."
READWRITE=NO ; if echo XXX > /cdrom/testfs 2>/dev/null ; then rm -f /cdrom/testfs 2>/dev/null
READWRITE=YES 2>/dev/null ; fi 2>/dev/null ; fst=ext2
echo -n "After testing $fromhd filesystem - READWRITE is: $READWRITE " ; echo ' but '
[ $READWRITE = NO ] && { if [ $fst = ext2 ] ; then /KNOPPIX/sbin/e2fsck -p $fromhd ; fi ; }
/KNOPPIX/bin/mount $fromhd -t $fst /cdrom -o remount,rw,exec && echo ">>>>> (Re)mount $fromhd -t $fst /cdrom -o remount,rw,exec" ;; esac

case "$CMDLINE" in *rmd*) kn=-rmd;; *k38new*) kn=-38new;; *k38*) kn=-38;; *k37*) kn=-37;; *) kn=-xx;; esac
case "$CMDLINE" in *mypat=/dev*) mdr=/mypat;; *mypat=/cdrom*) mdr=/cdrom;; esac ;
echo
if [ -d /zyx ] ; then rmdir /zyx ; # /zyx is created in modified linuxrc as a check point
echo ">>>>> Hi, from knoppix.sh. You are here if linuxrc is modified and your $mdr/ramdisk$kn should be set on hd."
else echo ">>>>> Hi, I am inside knoppix.sh before (re)mounting $mypat ==> $mdr for using hd based $mdr/ramdisk$kn "
echo
case "$CMDLINE" in *k37* ) echo "As Knoppix ==> k37 then $mdr/ramdisk$kn will be used without a real ramdisk, incl., $mdr/ramdisk$kn/etc$kn " ;;
* ) echo "As Knoppix ==> k38, then linuxrc already added /ramdisk to /UNIONFS, and your hd based $mdr/ramdisk$kn may be added only as a new branch, but /home and /tmp have been reconnected from RAM /ramdisk to hd $mdr/ramdisk$kn. Boot modified linuxrc to use $mdr/ramdisk$kn without ramdisk. " ;; esac

echo; mdr=ZZZ ; case "$CMDLINE" in *myfs=* ) fst=$myfs ;; * ) fst=ext2 ;; esac
case "$CMDLINE" in *mypat=/dev/* ) echo ">>>>> Mounting partition: mypat=$mypat ............"
if [ $fst = ext2 ] ; then /KNOPPIX/sbin/e2fsck -p $mypat ; fi
[ -d /mypat ] || mkdir -p /mypat ; [ -d /mypat ] && mdrp=/mypat ;
if /KNOPPIX/bin/mount $mypat -t $fst $mdrp -o rw,exec ; then mdr=$mdrp ;
echo ">>>>> $mypat is mounted as: mount $mypat -t $fst $mdr -o rw,exec " ;
else echo ">>>>> $mypat is not !!!!!!!!!!! mounted as: mount $mypat -t $fst $mdrp -o rw,exec"; fi ;;
*mypat=/cdrom* ) mdr=/cdrom ;; esac

[ -d $mdr ] || { echo 'No valid $mdr directory was found. Reboot and set mypat=/... as the boot line cheatcode, or enter directory where you saved (or would save) and use hd based $mdr/ramdisk$kn ==> /ramdisk '
read mdr ; echo "You entered: mdr=$mdr" ; sleep 2 ; }

[ -d $mdr/ramdisk$kn ] || mkdir -p $mdr/ramdisk$kn ; [ -d $mdr/ramdisk$kn ] && rmd=$mdr/ramdisk$kn

if echo "Hi, world" > $rmd/zt 2>/dev/null ; then rm -f $rmd/zt 2>/dev/null
echo ">>>>> Your writable ramdisk is: rmd=$rmd "
[ -d $rmd/home/knoppix ] || mkdir -p $rmd/home/knoppix
[ -d $rmd/home/knoppix ] && chown knoppix.knoppix $rmd/home/knoppix
[ -h /home ] && unlink /home 2>/dev/null ; [ -d /home ] && rm -fR /home 2>/dev/null ; ln -sf $rmd/home /home
[ -d $rmd/tmp ] || mkdir -p $rmd/tmp ; chmod 1777 $rmd/tmp
[ -h /tmp ] && unlink /tmp 2>/dev/null ; [ -d /tmp ] && rm -fR /tmp 2>/dev/null ; ln -sf $rmd/tmp /tmp
test -L /ramdisk || { [ -d /ramdisk/home ] && rm -fR /ramdisk/home 2>/dev/null
[ -d /ramdisk/tmp ] && rm -fR /ramdisk/tmp 2>/dev/null ; }

case "$CMDLINE" in
*k38new* ) # Knoppix-3.8, using UnionFS to save changings on hd ==> $rmd over /ramdisk without linuxrc modification
unionctl /UNIONFS --add $rmd ; unionctl /UNIONFS --mode /ramdisk ro 2>/dev/null ;;
*k38* ) ;;
*k37* ) # Knoppix ==> k37, moving /etc to hd, umount /ramdisk to free RAM memory, and link it with hd based directory
[ -d $rmd/etc$kn ] || mv -f /etc $rmd/etc$kn ; [ -d /etc ] && rm -fR /etc ; ln -sf $rmd/etc$kn /etc
[ -d /ramdisk/var ] && { [ -d $rmd/var ] || mv -f /ramdisk/var $rmd/ ; }
[ -d /ramdisk ] && umount /ramdisk 2>/dev/null ; rm -fR /ramdisk 2>/dev/null
# [ -d /ramdisk ] || mkdir -p /ramdisk ; mount --bind $rmd /ramdisk
[ -h /ramdisk ] && unlink /ramdisk 2>/dev/null ; ln -sf $rmd /ramdisk ; chmod 1777 /tmp /var/tmp
# [ -d $mdr/mycnf ] && $cpasr $mdr/mycnf/* /
#$cpaur /cdrom/mycnf/* / ; # I keep in .../mycnf my customized setting files; .../mycnf existed structure should duplicate root / .
# You may replace/copy ($cpaur) or replace/link $cpasr you settings to /... . In the last case you may only modify files in your .../mypat, but changing will be reflected in / immediately.
;; esac
else echo ">>>>> Your ramdisk rmd=$rmd is not writable !!!!!!!!!!!!!!!!!! " ; fi
fi # The end of the: if [ -d /zyx ]

[ -f $mdr/profile ] && $cpaur $mdr/profile /etc/
[ -d $mdr/boot ] && { [ -h /boot ] && unlink /boot; [ -d /boot ] || mkdir -p /boot; mount --bind $mdr/boot /boot; }

init q ; # put in action new /etc/initttab, e.g., to open additional terminals

# Automatically link at boot, if exist, your customized $rmd/usr to /usr :
[ -d $mdr/add/usr ] && { [ -h /usr ] && unlink /usr ; [ -d /usr ] && rmdir /usr &>/dev/null
[ -d /usr ] || mkdir -p /usr ; mount --bind $mdr/add/usr /usr ; }

# Connect, if exist, the latest Openoffice snapshot ( http://download.openoffice.org/index.html )
[ -d $mdr/add/opt ] && { [ -h /opt ] && unlink /opt ; [ -d /opt ] && rmdir /opt &>/dev/null
[ -d /opt ] || mkdir -p /opt ; mount --bind $mdr/add/opt /opt ; }

echo ; # swap setting
hdsw=`cat /proc/mounts | grep /dev/ | cut -d' ' -f2`
for i in $hdsw ; do
[ -s "$i"/swap.img ] && { swapoff "$i"/swap.img &>/dev/null ; swapon "$i"/swap.img ; } ; done
if cat /proc/swaps | grep swap &>/dev/null ; then
echo ">>>>> swap was found on your mounted /dev/... and activated as:"; cat /proc/swaps
else echo ">>>>> No swap was found on your mounted /dev/....... :" ; echo $hdsw ; fi
echo ; echo '>>>>> Use custom function: " mk sw /... " to make or change swap.img size on mounted /... '
echo '>>>>> Type "mk" to see what this function does. Type "free" to see RAM and swap usage. ' ; echo
#===============================

/etc/profile
Copy script to the end of the /etc/profile and use alias’s and functions:
#===============================
echo -n '>>>>> Hi from /etc/profile '
alias alp="alias -p" ; alias df="df -m" ; alias dfi="df -i" ; alias ps="ps aux" ; alias free="free -m"
alias cpa="/bin/cp -a " # -a ==> -dpR, incl., -dp ~preserve mode, links, etc
alias cpu="/bin/cp -u" # update; without -a ~follow links and copy real files
alias cpau="/bin/cp -au" # -a ~preserve and copy links
alias cpas="/bin/cp -as" # -s ~link files instead of coping
alias cpasu="/bin/cp -asu" ; alias cpap="/bin/cp -a --parents" ; alias cpaup="/bin/cp -au --parents"
alias cpar="/bin/cp -a --remove-destination --reply=yes"
alias cpasr="/bin/cp -as --remove-destination --reply=yes"
alias ddd="dd if=/dev/hda3 of=/d/b-h3 bs=512 count=1"
alias lil="lilo -C /boot/lilo.conf" ; alias lnks="ln -sf"
alias ml="mount -l" ; alias mm="cat /proc/mounts"
alias ul="unionctl /UNIONFS --list"
# alias for a string without an argument, but a function with arguments ~ $1. Functions see alias, but "..| xargs --replace .." not, and also cp... inside profile
# /etc/profile sets shell settings when starts a terminal, or press Cntr-D to renew profile settings.

CMDLINE="$(cat /proc/cmdline)"
case "$CMDLINE" in *rmd*) kn=-rmd;; *k38new*) kn=-38new;; *k38*) kn=-38;; *k37*) kn=-37;; *) kn=-xx;; esac
case "$CMDLINE" in *mypat=/dev* ) mdr=/mypat;; *mypat=/cdrom* ) mdr=/cdrom;; esac
[ -d $mdr/mycnf ] && mycnf=$mdr/mycnf ; rmdupd=$mdr/upd$kn

PATH=$PATH:$mdr:$mycnf/rootf ; LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export HOME PATH mdr mycnf LD_LIBRARY_PATH ; echo "======> HOME=$HOME " ; echo "mypat=$mypat mdr=$mdr mycnf=$mycnf "

[ -d $mycnf/.mc ] && { [ -h $HOME/.mc ] && unlink $HOME/.mc ; [ -d $HOME/.mc ] && rm -fR $HOME/.mc
ln -sf $mycnf/.mc /$HOME/ ; } # I keep .mc with customized menu in the $mycnf/.mc

#Custom functions:
chmo() { chmod 777 "$1" && chown knoppix.knoppix "$1" ; } # Quickly change after annoying "You do not have permission..."

cptar() { [ -z "$1" ] && { echo '>>>>> Preserve links and permissions during copping.';
type cptar ; return ; } ; [ -d "$2" ] || mkdir -p "$2" ;
(cd "$1" ; tar cvf - .) | (cd "$2" ; tar xpf -) ; } # Commands in (.. ; ..) executed in subshell

fnd() { case "$2" in i ) S2="-iname";; n ) S2="-name";; f ) S2="-type f";; d ) S2="-type d";;
xi ) S2="-xdev -iname";; xf ) S2="-xdev -type f";; * ) type fnd;; esac
S3="$3"; [ "$3" = x ] && S3=""; doit="$4"; [ -e $4 ] && doit=echo
[ -e $3 ] && echo 'Usage: find $1 -xdev $S2 $S3 | xargs --no-run-if-empty --replace $4 {} $5 '
find "$1" "$S2" "$S3" | xargs --no-run-if-empty --replace "$doit" {} "$5"
echo " It was find "$1" "$S2" "$S3" | xargs --no-run-if-empty --replace "$doit" {} "$5" " ; }

hdp() { case $1 in s ) hdparm -c3 -u1 -d1 -m16 -k1 /dev/hda ;; t ) hdparm -tT /dev/hda ;; * ) type hdp ;; esac ; }

hl() { "$1" --help | less ; } ; hm() { "$1" --help | more ; }

mk() { case $1 in
sw ) # >>>>> Use "mk sw /..." to make or change swap on mounted partition /...
swd=$mdr ; [ $2 ] && swd="$2" ; [ -s $swd/swap.img ] && {
echo ======= Do you agree with: `du -h "$swd"/swap.img` - y/n ;
read -t 200 answer ; case "$answer" in y*|Y*) swapoff $swd/swap.img ; swapon $swd/swap.img && echo ====== `du -h "$swd"/swap.img` is swapon; return ;;
n*|N*) swapoff $swd/swap.img ; rm -f $swd/swap.img && echo Removing $swd/swap.img ;; esac; }
[ -s $swd/swap.img ] && { echo ===== There is: `du -h "$swd"/swap.img`; swaapoff "$swd"/swap.img; }
df -m | grep $swd ; echo "Choose $swd/swap.img size and enter it in xxMB "
read sws ; dd if=/dev/zero of="$swd"/swap.img bs=1k count="$sws"k
mkswap "$swd"/swap.img ; swapon "$swd"/swap.img ;;
iso ) mkisofs -l -R -V "$2"-iso -hide-rr-moved -v "$3"/ | create_compressed_fs - 65536 > "$4"/"$2".iso ;;
isob ) mkisofs -l -r -J -V "$1" -hide-rr-moved -v -no-emul-boot -boot-load-size 4 -boot-info-table -b "$2" -c "$3" -o "$4" "$5" ;;
cloop ) [ ! -d "$3" ] && mkdir "$3" ; lsmod | grep cloop || insmod -f "$4"/cloop.ko file="$2" ; mount /dev/cloop "$3" ;;
intrd) dd if=/dev/zero of=$2 bs=1024k count=$3 ; mke2fs -F -m0 -b 1024 $2 ;;
mk2 ) mke2fs -F -m 0 "$3" "$2" ;; mk2n ) mke2fs "$2" -F -m 0 -b 1024 -i 1024 -N 100000 -n ;;
g ) gzip -9 "$2" ;; gu ) gunzip "$2" ;;
* ) type mk ; echo "Usage: mk sw,iso,isob,cloop,intrd,mk2,g,gu " ;; esac ; }

mn() { case $1 in
d ) [ -d /d ] || mkdir -p /d ; mount /dev/hda2 /d -t vfat -o rw,exec && echo /dev/hda2 mounted on /d ;;
fd ) [ -d /fd ] || mkdir -p /fd ; mount -t vfat /dev/fd0 /fd -o rw,exec ;;
l ) [ -d $2 ] || mkdir -p "$2" ; mount "$3" "$2" -o loop ;;
cdrom ) mount -t ext2 $fromhd /cdrom -o remount,rw,exec && echo "mount -t ext2 $fromhd /cdrom -o remount,rw,exec" ;;
cn ) [ -d /c ] || mkdir -p /c ; mount -t ntfs /dev/hda1 /c && echo " ntfs /dev/hda1 is mounted on /c ";;
cc ) [ -d /c ] || mkdir -p /c ; mount -t captive-ntfs /dev/hda1 /c && echo "captive-ntfs is mounted on /c ";;
ntfs ) # >>>>> Use "mn ntfs" to mount ntfs and creat its setting for the first time. Next, use "mn cc"
mkdir -p /c ; [ -z "$2" ] || { for i in ntfs.sys cdfs.sys fastfat.sys ntoskrnl.exe ; do
find $2 -iname $i | xargs --replace /bin/cp -f {} /var/lib/captive ; done ; }
[ -h /etc/group ] && unlink /etc/group ; [ -f /etc/group ] || $cpar /KNOPPIX/etc/group /etc/
echo "captive:101" >> /etc/group
[ -h /etc/gshadow ] && unlink /etc/gshadow ; [ -f /etc/gshadow ] || $cpar /KNOPPIX/etc/gshadow /etc/
echo "captive:*::" >> /etc/gshadow
useradd -g captive -d /var/lib/captive captive
mount -t captive-ntfs /dev/hda1 /c ;;
cloop ) lsmod | grep cloop || insmod /boot/cloop.ko file="$2"/KNOPPIX/KNOPPIX ; mount /dev/cloop "$3" ;;
u) umount "/$2" ;; * ) type mn ; echo ' Usage: mn d,fd,l,cc,cn,ntfs,cloop,u ';; esac ; }

psinst() { echo "Running post install updates" ; update-mime ; update-menus ; ldconfig ; }

rst() { upd r; date > $rmdupd/daterst ; case $1 in h ) halt ;; * ) reboot ;; esac ; }

upd() { [ -z "$1" ] && { type upd ; return ; } ; # >>>>> Backup files
drb=$rmdupd/etc-b ; [ -d $drb ] || mkdir -p $drb ;
/bin/cp -u /etc/{profile,inittab,lilo.conf,exclude,group,shadow,pa sswd} "$drb"
list="$mdr/knoppix.sh $mycnf/.mc/menu $mycnf/.mc/hotlist /linuxrc "
for i in $list ; do cpu "$i" "$drb" ; done
nf=$rmdupd/daterst ; [ -f $nf ] || date > $nf ; # For copy newer files than last reboot by function rst
drn=$rmdupd/etc-n ; [ -d $drn ] || mkdir -p /$drn
find /etc/ -type f -newer $nf | xargs --replace /bin/cp -au --parents {} "$drn" ;
drn=$rmdupd/etc-last ; [ -d $drn ] && /bin/rm -fR /$drn ; [ -d $drn ] || mkdir -p /$drn
find /etc/ -type f -newer $nf | xargs --replace /bin/cp -au --parents {} "$drn" ; }

updd() { [ -z "$1" ] && { type updd ; return ; } ; [ -d "$2" ] || mkdir -p "$2" ;
find "$1" -type f | xargs --replace /bin/cp -au --parents {} "$2" ; }
#===========================