Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Getting Started
Boot from ROM
File Systems (Background briefing)
ST Logo
Previous   Contents   Next

First some background on file systems. Normally Linux distinguishes between two things:

  1. The device driver for the physical hardware which the file system resides upon. Device drivers which support file systems are a special type of device, called a block device, because they only need to support the reading and writing of data in blocks. Typically a block corresponds to one or more sectors of a magnetic disk.
  2. The file system which resides on the block device. The file system presents the illusion of files, keeping track of where the files are stored on the device, looking up file names and keeping track of file permissions and modification times, for example.

Most file systems can be supported on any block device. By dividing the system this way, Linux gives maximum flexibility to the system designer.

Setting up a device for the first time has a number of steps:

  1. Some devices have to first be formatted before they can be used. Sometimes this is called a `low level' format, because it permanently lays down the fundamental block structure on what was hitherto a blank medium. There is usually a device specific command to do this. For example, floppy disks are formatted using the command fdformat.
  2. Some devices can be partitioned. This divides a large physical device into several smaller logical devices. This may be useful if a single device is to be used for several purposes. For example, different partitions can hold different file systems, possibly with different characteristics (read only and read/write for example) or for different operating systems. This is normally done using the command fdisk.
  3. Finally the file system is created. Most times this is done by providing the appropriate arguments to the mkfs command, for example mkfs -t ext2.

Once a file system has been created, it has to be mounted. This tells Linux which device the file system resides on, and where in the file hierarchy the new file system should appear. For example:

mount -t minix /dev/hda1 /home

Tells the kernel that the disk /dev/hda1 holds a minix format file system, and it should appear under the /home directory.

We previously said that normally the file system and block device driver are separate. In a couple of important cases this is not true, for example procfs and devfs present data to the user in the form of files, however there is no real data storage involved, the data returned to the user when listing a directory or reading a file is generated on the fly as required. Thus when the mount command is issued, the device field is ignored, and can be any string. Usually it is worth picking a meaningful name, for example:

mount -t procfs proc /proc

Another exception is JFFS2, which uses additional interfaces only provided by Flash device drivers to better manage a file system on top of Flash devices.

Previous   Contents   Next
Valid HTML 4.01! Last updated: 2002/08/02 18:57:01
© Copyright STMicroelectronics Limited, 2005
Printer