Mount points allow partitions and removable drives to be mounted and integrated into the Linux file system hierarchy. Filesystems can be manually mounted using the mount command and specifying the device and mount point directory. Filesystems are unmounted using the umount command on the device or mount point. Mount points are also configured automatically at boot through entries in /etc/fstab that specify the device, filesystem type, and mount options.
2. Exam Objectives
Key Knowledge Areas
Manually mount and unmount filesystems.
Configure filesystem mounting on bootup.
Configure user mountable removeable filesystems.
Objective 4: Devices, Linux Filesystems, Filesystem Hierarchy Standard
Control mounting and unmounting of filesystems Weight: 3
Terms and Utilities
/etc/fstab
/media
mount
umount
2
3. Control mounting and unmounting
Mount Points
3
If logical data is below root folder and there’s no change in the logical id of the partition
how do we see other logical data created by the other partitions that exist?
(Like C: change to D: and back to C: in windows )
All partitions are connected through the root directory via a mount point.
Mount point defines the place of a particular data set in the file system.
That is…
When a partition is mounted, files on its filesystem become part of the system.
In Linux partitions are mounted on directories, and files in the partition becomes files in the directory
Ex: # mke2fs /dev/hda2 # create the filesystem on a partition
# mkdir /home # make a place to put it
# mount /dev/hda2 /home # put it there
Use cmd mount to create mount points
4. Mount Points
4
Ex: ##
/etc/fstab
# Created by anaconda on Fri May 28 12:37:05 2010
##
Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=082fb0d5-a5db-41d1-ae04-6e9af3ba15f7 / ext4 defaults 1 1
UUID=488edd62-6614-4127-812d-cbf58eca85e9 /grubfile ext3 defaults 1 2
UUID=2d4f10a6-be57-4e1d-92ef-424355bd4b39 swap swap defaults 0 0
UUID=ba38c08d-a9e7-46b2-8890-0acda004c510 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
Example of Fedora 13 fstab with mount points
Control mounting and unmounting
5. Mount Points
5
Ex: # /etc/fstab: static file system information.
##
Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
##
<file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda7 during installation
UUID=8954fa66-e11f-42dc-91f0-b4aa480fa103 / ext3 errors=remount-ro 0 1
# /grubfile was on /dev/sda2 during installation
UUID=3a965842-b6dd-4d52-8830-2d0fdb4284a2 /grubfile ext3 defaults 0 2
/dev/sda5 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
developerWorks® ibm.com/developerWorks
Control
Example of Ubuntu 9.10 fstab with mount points
Control mounting and unmounting
6. Mount Points
6
Unmounting filesystems
Usually unmounted automatically on rebooted or shutdown.
When a filesystem is unmounted, any cached filesystem data in memory is flushed.
You may unmount manually.
This should be done for removing media (diskettes, DVD’s, USB drives).
Ex: # umount /dos
# mount /dev/sda9 /dos
# umount /dev/sda9
Use umount command, with argument for the device name or mount point
Control mounting and unmounting
7. Mount Points
7
After a filesystem is unmounted, any files in the directory used for the mount
point are visible again.
Ex: $ mount | grep sr0
/dev/sr0 on /media/KNOPPIX type iso9660 (ro,nosuid,nodev,uhelper=udisks,
uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500)
$ id acacio
uid=1000(acacio) gid=1000(acacio) groups=1000(acacio)
If there´s a process with open files on the fs to unmount it gives a error message.
Use lsof or fuser cmd to determine open files or processes with open files.
Option -w on lsof to avoid warning messages related to Gnome Virtual File system (gvfs).
Unmount removable media before removing.
Media Floppy (auto) DVD (udf) and CD’s (iso9660) can use cmd eject after cmd umount.
If device is not unmounted first, eject will both unmount and eject the disc.
Control mounting and unmounting