101 4.3 control mounting and unmounting of filesystems

8
Junior Level Linux Certification

Upload: acacio-oliveira

Post on 05-Dec-2014

229 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 101 4.3 control mounting and unmounting of filesystems

Junior Level Linux Certification

Page 2: 101 4.3 control mounting and unmounting of filesystems

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

Page 3: 101 4.3 control mounting and unmounting of filesystems

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

Page 4: 101 4.3 control mounting and unmounting of filesystems

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 1UUID=488edd62-6614-4127-812d-cbf58eca85e9 /grubfile ext3 defaults 1 2UUID=2d4f10a6-be57-4e1d-92ef-424355bd4b39 swap swap defaults 0 0UUID=ba38c08d-a9e7-46b2-8890-0acda004c510 swap swap defaults 0 0tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0

Example of Fedora 13 fstab with mount points

Control mounting and unmounting

Page 5: 101 4.3 control mounting and unmounting of filesystems

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 installationUUID=8954fa66-e11f-42dc-91f0-b4aa480fa103 / ext3 errors=remount-ro 0 1# /grubfile was on /dev/sda2 during installationUUID=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 0developerWorks® ibm.com/developerWorksControl

Example of Ubuntu 9.10 fstab with mount points

Control mounting and unmounting

Page 6: 101 4.3 control mounting and unmounting of filesystems

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

Page 7: 101 4.3 control mounting and unmounting of filesystems

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 acaciouid=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

Page 8: 101 4.3 control mounting and unmounting of filesystems

Fim de sessão

8