This post is both a request for help from experts who know better ways to do what I've kludged so far, and a suggestion to other beginners who may have similar needs and haven't gotten this far.

I'm using a knoppix DVD (5.1.1) plus a USB flash drive to create a customized environment that I can boot onto several different computers without disturbing the existing Windows installs on those computers.

On both of the computers I've used so far, Knoppix fails to even read the main NTFS partition, so the USB drive is the only place to put permanent data and the only path to get files in or out of the Knoppix boot (to/from other computers and to/from Windows).

I chose to format the usb drive with FAT32 for best communication between Knoppix and Windows and I created a native linux file system image as a file within that FAT32 file system to store things that needed linux ownership attributes, etc.. I initialy created that native file system as a persistent home directory, following the Knoppix instructions for doing so, but didn't like nor understand the way that operates it, so I renamed it (to avoid knoppix bootup finding it) and changed the way it gets merged into the file system.

My customizations are all built into two shell scripts in the FAT32 root directory that are run as a result of booting Knoppix with
knoppix 2 myconfig=scan
(I should be able to drop the 2 once the scripts are more stable. For now, I test a few potential script changes each time before doing init 5).

That finds the knoppix.sh file on the usb drive and executes it.

I took a lot of time trying to understand how to correctly use "mount -o remount" both for the usb drive and for the UNIONFS. I failed completely for the usb drive and nearly completely for the UNIONFS. I found that the feedback provided by a bare "mount" command does not match the actual current mount details of either file system. Without clear feedback on the results of "mount -o remount", I was flying nearly blind trying to find a way to use it correctly.

The usb FAT32 file system is mounted automatically to run knoppix.sh in a way that isn't usable for the things the shell script needs to do and (so far as I could tell) isn't correctable by "mount -o remount". So I found the work around of putting all the real work into a second script. My first knoppix.sh is just:

Code:
#!/bin/sh
cp "$1"/knoppix2.sh /tmp
. /tmp/knoppix2.sh
For those beginners who don't know (like me a few days ago):
The "$1" becomes the path (/media/sdc1 on one of my computers /media/sda1 on another) where knoppix.sh was found.
The dot space on the last line tells the shell to close the current .sh file and get the rest of its input from the specified file instead.
Earlier in the boot-up /tmp is linked to /ramdisk/tmp so that is a safe place to stand while dismounting the FAT32 file system.

Then knoppix2.sh begins with

Code:
#!/bin/sh
cd /
umount "$1"
pmount "$1"
I have no clue whether cd is really needed. I never figured out what "mount" options might duplicate the friendly way pmount mounts this device. I just fiigured out that pmount does what is needed and that the initial knoppix.sh must be closed before you can umount to enable that pmount.

Next (skipping some tests and tweaks) knoppix2.sh does
Code:
mkdir /img
chmod 777 /img
chown knoppix.knoppix /img
mount "$1"/me.img /img -o loop

mount -o remount,br:/ramdisk:/img=rw:KNOPPIX:KNOPPIX2 /UNIONFS /UNIONFS
ln -sfnv /img/home /home
I don't know whether the chmod and chown lines do anything useful. I'm trying to make everything mounted here as accesible to the GUI user as possible. The first and fourth lines together mount the filesystem inside the file me.img (that I renamed on the usb drive from the knoppix.img created by my earlier attempt to use persistent home directory).

The second mount remounts the aufs filesystem inserting /img as the second branch. I couldn't get that to work with the documented ( http://aufs.sourceforge.net/aufs.html ) add syntax, but it seems to work by restating the whole sequence of four branches as above.

I'm not certain this sequence of branches does what I want. I've read a lot and understand virtually nothing regarding auf's decision process in choosing between two writable branches for creation and copy_up of files. I probably will need to tweak things a bit:
For directories (mainly /etc) that are on multiple branches, I want it to search the ramdisk first because it is fastest. Any files in /etc that resulted from hardware specific customizations earlier in the boot sequence will already be on the ramdisk before I mount /img and will be correctly found since the ramdisk is the first branch. Hopefully, it won't be too hard to cause the /img branch to receive any later changes to /etc that I might make in the process of customizing the environment to my individual preferences, so those changes will persist across botts and across computers.

The final ln currently has no real effect, because there are no files in /ramdisk/home/knoppix. But I thought it will be faster and safer to use that until I start to understand auf's behavior with two writable branches, and general linux behavior of where files are stored. I have no idea where things like browser cache files go. I'd prefer to keep those off the flash drive and lose them on every reboot. I probably will need some teaks to this script to achieve that.

The rest of knoppix2.sh (after and in between the parts I quoted) all are specific to my own use of knoppix, so not relevent to this post. At the moment, most of that relates to display setting. I use three monitors in Windows on one computer and two on another. So far I've gotten Knoppix to use two out once out of the three, but only one of the two. In all cases, I got knoppix to use higher resolution than the stupid max choice it normally makes available during boot up.