Physical Devices  «Prev  Next»
Lesson 11 Removable media
ObjectiveDescribe how removable media are attached directly to the filesystem.

Removable media

As we saw in our examples with the floppy disk filesystem, removable media can be treated like regular partitions and attached to the filesystem directly. This attachment is done with the mount command, together with appropriate options to specify the filesystem on the media. For example, a CD-ROM often uses the iso9660 filesystem layout, and can be mounted with the following command on a Linux machine:

mount –t iso9660 /dev/cdrom /mnt

A floppy carrying an MS-DOS filesystem can be mounted on a Linux machine as follows:
mount –t umsdos /dev/fd0 /mnt
Consult the documentation for the mount command on your system to see how to specify the correct filesystem types on your system. For example, Solaris calls the msdos filesystem pcfs. It is important to unmount filesystems on removable media before ejecting them. This precaution is especially true for read-write media such as floppies.

Specify the correct filesystem for the mount command on a Unix System

To specify the correct filesystem for the mount command on a UNIX system, you need to know the filesystem type of the device or partition you want to mount. The mount command uses the "-t" option to specify the filesystem type. For example, to mount a device with an ext4 filesystem, you would use the following command:
mount -t ext4 /dev/sda1 /mnt/mydrive

In this example, "/dev/sda1" is the device or partition you want to mount, "/mnt/mydrive" is the mount point, and "-t ext4" specifies the filesystem type. If you are not sure of the filesystem type, you can use the "blkid" command to list all the filesystems on a device. For example, to list all the filesystems on the first partition of the first hard drive:
blkid /dev/sda1

The output of this command will show you the filesystem type, as well as other information about the partition. Note that in some cases, the mount command can automatically detect the filesystem type. For example, if you try to mount a CD-ROM or DVD, the mount command will automatically detect the filesystem type as ISO 9660. However, it is still recommended to specify the filesystem type explicitly using the "-t" option, to ensure that the correct filesystem driver is used.

Solaris has a removable media manager (called vold) that detects the insertion of CD-ROMs and floppies, then mounts them under /cdrom and /floppy in directories corresponding to the media label. This daemon program is configured by two files, /etc/vold.conf and /etc/rmmount.conf. See the Solaris documentation for more details.