6. Some basic concepts

In this section we discuss in a very brief manner, some basic Linux concepts which should contribute to an understanding of the procedures described below.

6.1. The /proc filesystem

The /proc filesystem serves as a window through which we can see the workings of a Linux setup. The objects of most interest for this document are the directories/proc/bus/usb/ and /proc/scsi/. These will be used to verify that the kernel had been set up properly for our purpose (Section 7.2).

6.2. SCSI devices

Your memory stick will be considered as a USB mass storage device posing as a removable SCSI disk (sd). SCSI disk devices are mapped to the /dev (devices) directory under /dev/sda , /dev/sdb , ... When different disk devices are present, they will be mapped to /dev/sda, /dev/sdb, etc. If, for example, a memory stick and a digital camera are plugged in, the one would be mapped to /dev/sda and the other to /dev/sdb. Tests have indicated that the first device to be detected is mapped to sda and represented in the directory /proc/scsi/usb-storage-0. The second will be mapped to sdb and represented in /proc/scsi/usb-storage-0. What will happen when both devices are present at boot-up, is not known. An overview of the partitions relevant to this document, the file /proc/partitions may be consulted. Look for entries like sda, sda1, sdb. Under the Linux-2.6 series of kernels this problem may be very neatly resolved (Section 12).

In the descriptions further on, it will be assumed that only one memory stick is present, and therefore mapped to /dev/sda.

In most distributions these points exist in abundance. You should check that this is the case in your setup (ls /dev/sda*. If there are none you can create them by doing (as root, indicated by the hash).


             # mknod /dev/sda  b 8 0
             # mknod /dev/sda1 b 8 1
             # mknod /dev/sda2 b 8 2
   

etc, up to /dev/sda15 if necessary. The device as a whole is mapped to /dev/sda, while /dev/sdax (x = 1 ... 15) represent the various partitions of the device. We shall describe, later on, how to create different partitions for different file systems (see Section 8 and Section 9 ). If you intend to use your memory stick with a single partition (filesystem), /dev/sda1 is sufficient.

6.3. The USB device filesystem

This dynamically generated filesystem should be mounted at /proc/bus/usb/. It is therefore essential that this mount point exists. Once it is mounted, there should be more to be seen in /proc/bus/usb/ and in /proc/scsi/ (Section 7.3). To find out which USB devices are present, read the file /proc/bus/usb/devices ( less /proc/bus/usb/devices). It takes a small effort to interpret the writing on the screen, but it is not difficult. A memory stick is indicated by Mass Storage Device.

6.4. The ext2 filesystem

The ext2 (second extended) filesystem still is the most prevalent in Linux setups. It is most versatile and sophisticated, carrying with it permissions (read-write-execute, who is permitted to do what), ownership (user, group, others), a timestamp (when last modified), etc. Moreover, tools for the proper maintenance of a device endowed with ext2, exist (Section 11). If a flash memory device is to be used exclusively within Linux setups, it is therefore desirable to format it in ext2 (see Section 8).

6.5. The vfat filesystem

Enabling vfat in the kernel makes it possible to mount filesystems created under Dos/Windows to be mounted in a Linux system. Most memory sticks are formatted for direct use on Windows and should therefore be considered as vfat-formatted. The vfat filesystem is less sophisticated than ext2 and will therefore be more economic as far as memory space is concerned. It does not carry permissions in the same way as ext2 with the result that an ext2-file saved in vfat will re-appear with its permissions changed. Nonetheless, if a memory stick is to be used for the purpose of carrying data between Linux and Windows machines, it is best to keep it in the vfat format. A compromise is to partition the memory stick in two parts: one in vfat and the other in ext2. At least the Linux machine should be able to handle both. This is described in Section 9

6.6. Explanation of command options

Here is a short list of command options that occur in this document:

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:28