First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.
Putting Linux to work - Mounting file systems
- — 01 December, 2000 18:02
One of the strengths of Linux is its support for a variety of file systems. The default file system for Linux is the second extended file system, or ext2. When you install Linux, the root and other partitions will be formatted with the ext2 file system. "Mounted" is the term given to file systems that are currently in use on a given system - whether it is a hard drive or external devices such as floppy disks and CD-ROMs.
To determine which file systems are presently in use by your system, type:
at a command prompt. This will display all the mounted file systems in terms of the device, file system type and the mount point. The mount point is the local directory that is assigned to a file system during the process of mounting.
In order to use floppy disks and CD-ROMs you must mount them first. Login as root and start by making three directories that will be used as mount points:
$ mkdir /floppy /cdrom /win
However, your system may already have two such directories under the /mnt directory for this purpose, i.e., /mnt/floppy /mnt/cdrom. Many people using Linux for the first time will want to access MS-DOS formatted floppy disks in order to use Windows files within Linux. To mount a floppy with this format, put the disk in the drive and as root type:
$ mount -t msdos /dev/fd0 /floppy
This allows the mount command to mount an MS-DOS formatted file system as indicated by the -t (type) option. The device as recognised by the kernel is located at /dev/fd0 (as in device Floppy Disk 0) and the mount point is the /floppy directory. Now you can access the MS-DOS formatted floppy disk as you would any other directory. A similar command would be used to mount an ext2 formatted floppy except you would type "ext2" instead of "msdos".
Mounting a CD is similar, however, the file system and device are different:
$ mount -t iso9660 /dev/cdrom /cdrom
The iso9660 file format is standard for all CD-ROM media and is also the default format that the mount command uses for mounting /dev/cdrom. You can access your CD-ROM and all the files on it through the /cdrom directory. Note that some desktop environments automatically will mount a CD as it is placed in the drive.
When you are finished using any external file system you will need to unmount it; this is the process of telling the kernel that you are no longer accessing that particular file system. In order to unmount a file system you must not be accessing it in any way, meaning that your working directory cannot be the particular mount point. The umount command is used for unmounting file systems:
$ umount /floppy
$ umount /cdrom
This will unmount your CD-ROM and floppy drives, allowing you to change the media. With unmounting, only the mount point or device needs to be specified.
The mount command can also be used to mount partitions on local hard drives. This is very useful for accessing your Windows partition and sharing files between Windows and Linux on one computer. Windows 9x partitions are usually formatted as FAT16 or FAT32, FAT standing for File Allocation Table.
Linux will recognise FAT file systems and they can be classified vfat when mounting. To mount your Windows partition type:
$ mount -t vfat /dev/hda1 /win
Since your Windows partition is likely to be the first partition on the first IDE hard drive, it will be classified as hda1. If /dev/hda1 does not hold the Windows partition, use the "df" command see which partitions are not mounted under Linux (it may be /dev/hda2, for example) and use them instead.
The /win directory will now allow you to access all your Windows files, which can be transferred to and from your Linux system.
For a more detailed summary of the mount command see its online manual page located at:
$ man mount
The /etc/fstab file
The Linux file system table, or /etc/fstab, is a file that can be used to predefine mount points and other variables. Every time the mount command is issued, the /etc/fstab is read for this purpose. Using a text editor, and while logged in as root, edit your /etc/fstab file to look like the one illustrated below.
An example of a /etc/fstab file
DEVICE MOUNT POINT TYPE PARAMETERS
/dev/hdb3 / ext2 defaults 1 1
/dev/hdb4 swap swap defaults 0 0
/dev/fd0 /floppy msdos noauto,rw 0 0
/dev/cdrom /cdrom iso9660 noauto,ro 0 0
/dev/hda1 /win vfat nosuid,rw 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
This allows you to mount a CD-ROM or MS-DOS formatted floppy by executing the appropriate command below:
$ mount /cdrom
$ mount /floppy
This works because the mount conditions for each type of file system have been set in the /etc/fstab file. The explanations for the variables in the parameters section are all available in the mount manual page.
Mounting file systems is a necessary utility that can be applied in various ways to increase the amount of access your system has to peripheral devices and different operating systems.