linuxdot.org Linux Expo Birmingham 2002
Linux news | Newbie's Linux manual | Linux links | Link us
The Linux columns | Book reviews
  DistroWatch + TuxReports November 2, 2002

Contents | Previous | Next | Download

Accessing block devices

In order to access a block device, like a floppy, CD, or hard drive partition you need to mount it. To mount something, means to make it part of the Linux filesystem. This you do by associating a particular device file (a special file in the /dev directory) with a mount point (a directory where the contents of the block device will be located).


/etc/fstab

To set-up mounting you edit the /etc/fstab file. Each line consists of six space or tab separated columns. The six columns represent:

device   mount_point   filesystem_type   mount_options   dump   check

For example:

/dev/hda1   /mnt/c   vfat   noauto,user   0 0

Note:

For further details refer to the fstab and mount man pages.

Device

Device Description
hda IDE hard drive, master drive on primary controller (primary master).
hdb IDE hard drive, slave drive on primary controller (primary slave).
hdc IDE hard drive, master drive on secondary controller (secondary master).
hdd IDE hard drive, slave drive on secondary controller (secondary slave).
hdxn Partition n on IDE hard drive hdx (/dev/hda1, /dev/hda2, /dev/hda3, etc.).
   
sdx SCSI drive x (/dev/sda, /dev/sdb, /dev/sdc, etc.).
sdxn Partition n on SCSI drive sdx (/dev/sda1, /dev/sda2, /dev/sda3, etc.).
   
/dev/cdrom Symbolic link to CD-ROM device.
/dev/scdn SCSI CD-ROM drive.
   
/dev/fdn Floppy drive n, with disk type automatically detected (/dev/fd0, /dev/fd1, etc.).
(See the fd man page for manual floppy specification.)

Mount point

The directory to mount the disk or partition to. Can be anything you want, but it's common to create a directory in the /mnt directory, and mount to that directory. For example: /mnt/cdrom

Filesystem type

The following are some commonly used filesystem types supported by Linux:

Type Description
auto Autodetection of filesystem, for floppy disks.
ext2 Linux extended filesystem 2. (The current main native Linux filesystem.)
ext3 Linux extended filesystem 3.
iso9660 CD-ROM filesystem.
msdos MS-DOS filesystem.
ntfs Windows NT filesystem.
vfat Microsoft Windows 95/98/Me filesystem.

Mount options

The following are some common mount options:

Option Description
auto Automatically mount filesystem at boot-time.
noauto Don't mount filesystem at boot-time.
user Allow users to mount filesystem.
nouser Only root can mount filesystem.
ro Read only.

Dump

Used by the dump command for an ext2 filesystem backup. '0' for no dumping, '1' for dumping. Unless you plan to use dump to backup ext2 partitions, use '0'.

Check

The order of filesystem checks at boot time. ('0' to not check, '1' for check first, '2' to check later.) Use '1' for the root (/) partition, '2' for other hard drive partitions, and '0' for everything else.


mount

With an entry for the block device in the /etc/fstab file and the mount point (directory) created, to mount the device, enter:

mount mount_point


umount - unmount

To unmount a device, be out of the mount point directory and enter:

umount mount_point

Contents | Previous | Next | Download

About us  
Latest stable kernel: 2.4.19 | Latest development kernel: 2.5.44
Copyright © 1998-2002 Linuxdot.org.
Linux ® is a registered trademark of Linus Torvalds.