This is the old ROX web-site. Please use the new website instead.

This document explains how Linux handles storage media (CDs, floppies, zip disks, memory sticks, hard drives, etc).

Linux has a single global filesystem. Physical devices are mounted on this filesystem. For example:

/ is the root directory on a partition on your hard drive.

/etc is a subdirectory on the same partition.

/cdrom is the root directory on the CD-ROM.

/cdrom/data is a subdirectory on the CD.

The filesystem layout on most Linux systems follows the httpFilesystem Hierarchy Standard to some degree. The layout is a bit of a mess, for historical reasons. However, it may help you if you're feeling lost.

Devices

Every storage device has a corresponding device file in /dev. Also, each partition on the device has its own device file. When you plug in a USB memory stick, you should see a new device appear in /dev (if you have a modern system).

The filesystem table

The configuration file /etc/fstab contains a list of mount points and their corresponding devices in /dev. For example, this line says that partition 1 (the only one) on the Jumpshot flash card reader should be mounted on /flash. It is an MSDOS format partition, can be mounted by a user, and isn't mounted at boot time. Use man fstab to get more details about this.

/dev/Jumpshot-1 /flash  msdos   user,noauto             0       0

Adding a new storage device

Note: many distributions provide a graphical program to help you add devices. Use that if available.

  1. Ensure an entry appears in /dev when the device is plugged in.

  2. If the device you are adding isn't formatted (eg, a new hard drive), you need to format it now:

    1. Use cfdisk or similar to devide the device into partitions (possibly just creating one big partition).
    2. Format each partition with the format you want (MSDOS, ext3, etc). Different filesystems give different performance and compatibility. Use MSDOS if the partition should be shared with windows. ext3 is a good choice for native Linux partitions. You can format a partition with mkfs. Warning: this program destroys any existing data on the partition, and it doesn't confirm. Check you've got the right device very carefully!
  3. Create a directory in the filesystem to mount it on (eg, mkdir /flash).

  4. Add a line to /etc/fstab associating that device with the new mount-point.

  5. The directory should now appear with a mount-point symbol over it in ROX-Filer (you may need to click Refresh on the toolbar).

  6. Click on the mount point to mount it, giving you access to the files on the device.

Preventing frequent filesystem checks

Sometimes when booting, the system will stop and do a full check of a partition. This is to fix any errors which might have appeared. However, sometimes it does the checks too often (usually because you reboot a lot). There are three situations in which a check will be done:

For a desktop machine you may be rebooting very often, and therefore trigger a lot of checks (eg, every few weeks). You can disable the count check, and set a check interval, using tune2fs. Eg, this command sets partition hda1 to be checked every six months, but never based on number of mounts:

tune2fs -i 6m -c 0 /dev/hda1

Last edited on September 14, 2004 7:33 am.