Monday, September 10, 2007

3. Understanding the filesystem - COMPLETE

It took me a while to understand how the files system works with DSL. To get a grip on it you need to understand the boot process too which is not clear to a Windows user. It is much more technical than we are used to. Here's my way of explaining it...

If you go into emel-fm (a file manager that takes a bit of getting used to is you are familiar with Explorer) you will see that in the root directory (/..) there are a bunch of folders. They are NOT a consistent set of folders / files that you might see in Windows explorer. Don't think of them as such. Here are the varieties you get:

1. Some are symlinks (shortcuts) to regularly used folders. (They can be recognised as light blue folders in EmelFM)
2. Some are real but transient folders set up at boot time within RAM.
3. Some are mounted drives. Drives don't appear in the same way in DSL - they are mounted as folders.
4. Mounted images - the main Knoppix file is treated in this way.

When booting up, there is a bunch of primordial stuff that happens at low level that is handled by the loader (grub in our case). During that phase, it loads what is known as the kernel. This is the shell or environment that allows everything to start to talk to each other. The programs can interface with the hardware and different bits of hardware can talk to each other and so on.

Once the kernel is loaded, the main operating system files (/Knoppix) are hunted down on the system. In our case, these are on hda1. The basic DSL files stored in this image are then installed into RAM at /KNOPPIX. These files allow the Operating system to run. A bunch of shortcuts to commonly used folders are also set up for ease of use.

In addition, the orginal KNOPPIX image that was found is mounted for its own purposes (you could say that a shortcut to the main file is setup) under the /cdrom folder. Hence the Operating system can call on the other stuff it needs whenever and you can access the files / folders you are most likely to need quickly. This is all very sensible when you think about it.

Back to persistence again:
As discussed, some of the files are in RAM. The ones that are in RAM can be changed for the most part - some are actually in use so can't be changed. When you start to change these files - nothing will last until you backup your changes. To do this:
1: Click System > Backup/Restore (if it does not default to your 2nd drive then select type the name of the drive e.g. hda2) and
2: Introduce the cheatcode: restore=hda2. This restores your settings that you have just backedup. More about this later!

N.B. The KNOPPIX image loaded at /cdrom is not writable either because it is in constant use by the OS. Hence - at a later stage we may need to remaster the image. I am not sure just yet if I can get away with this project in backups only.

I began to write in some depth at this point about what all the individual folders do. It seemed very peculiar that there was a 'lost & found' folder nearly everywhere I looked.Rather than go into real detail about what individual folders and files do and how they work. You can have a pretty good guess what each of them does and you'll probably be right. To find out more specifically about what is happening where. You can go and read The Linux Documentation Project (http://www.tldp.org/) and click on Guides and find the one on Linux Filesystem Hierarchy. This will explain everything in a lot more depth.

For now, I think we have enough to go on with, incidentally the 'lost & found' folder is found on all partitions for lost files / part files during system failures. That's why you see it around a lot!

No comments: