The
most common thing to be mounted is a hard drive partition. Hard drives
are kept in /dev and have different names depending on what type of
drive they are. IDE/ATA drives are labelled as /dev/hda, /dev/hdb,
/dev/hdc and /dev/hdd (since a PC's IDE interfaces can only handle 4
devices at a time). Note that these can be devices such as IDE/ATA
CDROMS, Compact Flash to IDE converters, and some special floppy drives
(although they tend to appear mainly in laptops). For SCSI devices the
labels are /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf,
/dev/sdg, /dev/sdh and /dev/sdi (since a SCSI chain can contain up to
nine devices). Other types of drive, such as USB, SATA, etc. are mapped
to these SCSI devices by Linux. Therefore SATA and USB drives are
labelled as /dev/sdX where X is a letter, starting at "a".
Since these are literally the devices you can issue a command such as:
sudo eject /dev/hdc
If /dev/hdc is a CD drive then it will eject.
In
the case of hard drives, there is another abstraction. A hard drive
(and many devices such as USB "sticks" which act like hard drives) can
be partitioned to allow many filesystems to be stored on them. This
means that the filesystems themselves are accessible via the partition
labels, such as /dev/hda1 (the first partition on /dev/hda). This means
that we finally know about something we can mount, a partition, since
it contains a filesystem.
Another
physical filesystem which can be mounted is the ISO9660 filesystem used
on CDROMs. Since there is only ever one CD in a CD drive there is no
point creating /dev/hdc1 (where /dev/hdc is a CDROM drive) since there
is only one filesystem on it. That means that you can mount CD drive
devices explicitly, so if /dev/hdc is a CDROM drive then it is possible
to mount /dev/hdc if there is a disc in it.
Floppy
disks only contain one filesystem, and are labeled as /dev/fd0 for the
first drive, /dev/fd1 for the second drive, etc. So now we know three
things which can be mounted.
Devices
like USB sticks are treated like hard drives (so /dev/sda1, for
example, may contain a filesystem) and so are iPods (although I think
the main data on an iPod is stored on the second partition)
Mounting
is not restricted to physical devices. If you have a filesystem "image"
(which IS a filesystem, whether an exact copy of an existing
filesystem, or a filesystem created specifically for that file) then
you can mount that through the use of a fake device called the
"loopback device"
How To Mount/Unmount Filesystems
Unmounting
Firstly
I will tell you how to unmount any filesystem you mount after trying
these commands. Unmounting is done through the "umount" command, which
can be given a device or a mount point so:
sudo umount /mnt
sudo umount /dev/hda1
Would both unmount the filesystem on /dev/hda1 if it is mounted on /mnt.
Remember
that a filesystem cannot be in use when it is unmounted, otherwise
umount will give an error. If you know it is safe to unmount a
filesystem you can use:
sudo umount -l /mountpoint
The
most common thing to be mounted is a hard drive partition. Hard drives
are kept in /dev and have different names depending on what type of
drive they are. IDE/ATA drives are labelled as /dev/hda, /dev/hdb,
/dev/hdc and /dev/hdd (since a PC's IDE interfaces can only handle 4
devices at a time). Note that these can be devices such as IDE/ATA
CDROMS, Compact Flash to IDE converters, and some special floppy drives
(although they tend to appear mainly in laptops). For SCSI devices the
labels are /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf,
/dev/sdg, /dev/sdh and /dev/sdi (since a SCSI chain can contain up to
nine devices). Other types of drive, such as USB, SATA, etc. are mapped
to these SCSI devices by Linux. Therefore SATA and USB drives are
labelled as /dev/sdX where X is a letter, starting at "a".
Since these are literally the devices you can issue a command such as:
sudo eject /dev/hdc
If /dev/hdc is a CD drive then it will eject.
In
the case of hard drives, there is another abstraction. A hard drive
(and many devices such as USB "sticks" which act like hard drives) can
be partitioned to allow many filesystems to be stored on them. This
means that the filesystems themselves are accessible via the partition
labels, such as /dev/hda1 (the first partition on /dev/hda). This means
that we finally know about something we can mount, a partition, since
it contains a filesystem.
Another
physical filesystem which can be mounted is the ISO9660 filesystem used
on CDROMs. Since there is only ever one CD in a CD drive there is no
point creating /dev/hdc1 (where /dev/hdc is a CDROM drive) since there
is only one filesystem on it. That means that you can mount CD drive
devices explicitly, so if /dev/hdc is a CDROM drive then it is possible
to mount /dev/hdc if there is a disc in it.
Floppy
disks only contain one filesystem, and are labeled as /dev/fd0 for the
first drive, /dev/fd1 for the second drive, etc. So now we know three
things which can be mounted.
Devices
like USB sticks are treated like hard drives (so /dev/sda1, for
example, may contain a filesystem) and so are iPods (although I think
the main data on an iPod is stored on the second partition)
Mounting
is not restricted to physical devices. If you have a filesystem "image"
(which IS a filesystem, whether an exact copy of an existing
filesystem, or a filesystem created specifically for that file) then
you can mount that through the use of a fake device called the
"loopback device"
How To Mount/Unmount Filesystems
Unmounting
Firstly
I will tell you how to unmount any filesystem you mount after trying
these commands. Unmounting is done through the "umount" command, which
can be given a device or a mount point so:
sudo umount /mnt
sudo umount /dev/hda1
Would both unmount the filesystem on /dev/hda1 if it is mounted on /mnt.
Remember
that a filesystem cannot be in use when it is unmounted, otherwise
umount will give an error. If you know it is safe to unmount a
filesystem you can use:
sudo umount -l /mountpoint
75 views
Usually answered in minutes!
×