# Access Linux File Systems ## Dennis Kibbe ### Mesa Community College Note: This slide presentation was created using [Reveal.js](https://revealjs.com/). You can access a transcript of this presentation by pressing S for speaker notes. You can access navigation help by pressing the question mark key. Audio for this presentation is artificially generated. --- # Module Outline 1. Introduction 1. Identify File Systems and Devices 1. Quiz 1. Mount and Unmount File Systems 1. Guided Exercise 1. Key Takeaways 1. Resources 1. Graded Lab Note: --- # Learning Objectives *After completing the work in this module you will be able to:* 1. Find the device mounted on a directory. 1. Add and remove file systems from the file system hierarchy. 1. Search for files using the `locate` and `find` commands. Note: --- # Identify File Systems and Devices ![Diagram of Linux Hierarchy Filesystem](../images/fsh.png) Note: Before a file system can be used it must be mounted on an existing directory. --- # Disk Partitions ![screenshot of a partitioned disk](../images/guid_partition_table.png) Note: --- # Logical Volume Management (LVM) ![diagram of lvm partitioning](../images/lvols.png) Note: --- # Examine File Systems ``` dennisk@sahuaro:~$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 1.6G 2.4M 1.6G 1% /run /dev/nvme0n1p2 468G 53G 392G 12% / /dev/nvme0n1p1 511M 6.1M 505M 2% /boot/efi /home/dennisk/.Private 468G 53G 392G 12% /home/dennisk ``` Note: --- # Quiz ## Identify File Systems and Devices Note: --- # Mount and Unmount File Systems ``` dennisk@sahuaro:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 476.9G 0 disk ├─nvme0n1p1 259:1 0 512M 0 part /boot/efi └─nvme0n1p2 259:2 0 476.4G 0 part / ``` Note: --- # Mount File System with the Partition Name ``` [root@servera ~]# mount /dev/vda4 /mnt/data ``` Note: --- # Mount File System with Partition UUID ``` dennisk@sahuaro:~$ lsblk -fp NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS /dev/nvme0n1 ├─/dev/nvme0n1p1 vfat FAT32 F8AD-FB69 504.9M 1% /boot/efi └─/dev/nvme0n1p2 ext4 1.0 e84f5519-cf89-4e75-9b9b-4e7dd027f7fa 391.7G 11% / ``` Note: --- # Unmount File Systems ``` [root@servera ~]# umount /mnt/data ``` Note: If a filesystem is in use (has open files) all processes must be stopped before the file system can be unmounted. --- # The `/etc/fstab` File ![The /etc/fstab file](../images/fstab.png) Note: The `/etc/fstab` file contains file systems which are mounted at boot. Here the root file system and the efi filesystem are mounted. --- # Guided Exercise ## Mount and Unmount File Systems Note: --- # Locate Files on the System Note: --- # The `locate` Command ``` dennisk@sahuaro:~/Public/cis126rh$ locate ssh /etc/ssh /etc/X11/Xsession.d/90x11-common_ssh-agent /etc/gufw/app_profiles/ssh.gufw_service /etc/ssh/ssh_config /etc/ssh/ssh_config.d ...output omitted... Note: --- # The `find` Command ``` dennisk@sahuaro:~$ find -name *ssh* ./Public/images/ssh_remote_exit.png ./Public/images/ssh_permissions_too_open.png ./Public/images/openssh.jpg ./Public/images/ssh_remote.png ./.ssh ``` Note: --- # Guided Exercise ## Locate Files on the System Note: --- # Key Takeaways 1. Storage devices are identified by block device file type. 1. File systems are mounted on an existing directory. 1. A file sytem caan not be unmounted if there are open files on the file system. 1. Removable media is mounted under `/run/media`. 1. You can use the `lsblk` command to list block devices. 1. The `find` command searches in real time while the `locate` command uses an index file. Note: --- # Resources - [An introduction to the Linux /etc/fstab file](https://www.redhat.com/sysadmin/etc-fstab) - [2 Minute Linux Tip: The find Command](https://www.infoworld.com/video/89095/linux-tip-how-to-use-the-find-command) - [What Is a Block Device?](https://phoenixnap.com/glossary/block-device) Note: Here are some resources for the topics covered in this chapter. --- # Graded Lab ## Access Linux File Systems ![Screenshot of a sample grading script](../images/lab_techs.png) Note: --- ![Mesa Community College logo](../images/mcc_logo.png "Mesa Community College") Note: This ends this slide presentation. I hope you found it useful.