SlideShare a Scribd company logo
1 of 24
Download to read offline
CIT 173
Introduction to Linux.
Instructor
Lily Morningstar
ACCESSING
LINUX
FILE SYSTEM
This Photo by Unknown
Author is licensed under
CC BY-NC
GOALS: LEARNING OUTCOMES
Access, inspect, and use
existing file systems on
storage attached to a
Linux server.
IDENTIFYING
FILE
SYSTEMS
AND DEVICES
Files on a
Linux
server
are
accessed
through
the file-
system
hierarchy
A single inverted
tree of directories.
Assembled from file
systems provided by
the storage devices
on your system.
Each file system is a
storage device that
has been formatted
to store files.
FILE SYSTEM
HIERARCHY
This Photo by Unknown Author is licensed under CC BY-SA-NC
The hierarchy presents a collection of
file systems on separate storage
devices as if it were one set of files
on one giant storage device that you
can navigate.
Most of the time, you
don’t need to know
which storage device a
particular file is on,
you just need to know
the directory that file
is in.
You might need to
determine how full a
storage device is and
what directories in the
file-system hierarchy
are affected.
There might be errors
in the logs from a
storage device
Hard link between two
files.
HIERARCHY
FHS
The file system hierarchy assembles
all the file systems into one tree of
directories with a single root, the /
directory
MOUNT POINTS,
DISK PARTITIONS
AND LOGICAL
VOLUMES
This Photo by Unknown Author is licensed under CC BY-SA-NC
FILE SYSTEMS AND
MOUNT POINTS
Makes the contents of a
file system available in
the file-system hierarchy
Must be mounted on an
empty directory (mount
point)
Once mounted, if you
use ls to list that
directory, you will see
the contents of the
mounted file system
Many file systems are
automatically mounted
as part of the boot
process.
Microsoft Windows
drive letters, are a
fundamentally different
concept.
It is somewhat similar to
the NTFS mounted
folders feature.
FILE SYSTEMS, STORAGE,
AND BLOCK DEVICES
Low-level access to storage devices in
Linux is provided by a special type of
file called a block device
Block devices must be formatted with
a file system before they can be
mounted.
Block device files are stored in the
/dev directory
Device files are created automatically
by the operating system.
In Red Hat Enterprise Linux, the first
SATA/PATA, SAS, SCSI, or USB hard
drive detected is called /dev/sda, the
second is /dev/sdb, and so on
•represent the entire hard drive
•other types of storage will have other forms
of naming
DISK PARTITIONS
Disk Partitions
Storage devices are divided up into
smaller chunks called partitions.
Partitions allow you to
compartmentalize a disk
Partitions can be formatted with
different file systems or used for
different purposes.
user home directories, system data,
logs. If a user fills up the home
Partitions are block devices in their
own right.
SATA-attached storage, the first
partition on the first disk is
/dev/sda1.
Paravirtualized storage devices
have a similar naming system.
An NVMe-attached SSD device is
/dev/nvme0p1.e1p3
A long listing of the /dev/sda1
device file on host reveals its special
file type as b, which stands for block
device:
STORAGE MANAGEMENT CONCEPTS
A file system is an organized
structure of data-holding files and
directories residing on a storage
device, such as a physical disk or
partition.
The advantage of FSH existing
hierarchy can be extended at any
time by adding a new disk or
partition containing a supported file
system to add disk space anywhere
in the file system tree. The process
of adding a new file system to the
existing directory tree is called
mounting.
The directory where the new file
system is mounted is referred to as a
mount point. This is a fundamentally
different concept than that used on
a Microsoft Windows system, where
a new file system is represented by a
separate drive letter.
Hard disks and storage devices are
normally divided up into smaller
chunks called partitions. A partition
is a way to compartmentalize a disk.
Storage devices are represented by a
special file type called block device.
The block device is stored in the
/dev directory. In Red Hat Enterprise
Linux, the first SCSI, PATA/SATA, or
USB hard drive detected is /dev/sda,
the second is /dev/sdb. This name
represents the whole drive. The first
primary partition on /dev/sda is
/dev/sda1, the second partition is
/dev/sda2.
A long listing of the /dev/vda device
file on serverX reveals its special file
type as b, which stands for block
device
LOGICAL VOLUMES
LVM relies on the Device Mapper (DM) kernel driver.
The symbolic link /dev/myvg/mylv points
to the /dev/dm-number block device
node.
The assignment of the number is
sequential beginning with zero (0).
There is a symbolic link for every logical
volume in the /dev/mapper directory
with the name /dev/mapper/myvg-mylv.
Access to the lv can use either of the
consistent and reliable symbolic link
names
/dev/dm-number name can vary with
each boot.
Volume group and the logical volume have names assigned upon creation.
volume group, a directory with the same name as the volume group exists in the /dev directory. below that directory, a symbolic link with the same name as the logical volume has been created.
Another way of organizing disks and partitions is with logical volume management (LVM).
one or more block devices can be aggregated into a storage pool called
a volume group.
Disk space is made available with one or more logical volumes.
A logical volume is the equivalent of a partition residing on a physical
disk.
EXAMINING FILE
SYSTEMS
• To get an overview about the file
system mount points and the
amount of free space available, run
the df command. (Recall you saw
this command in Chapter 3.)
• When the df command is run
without arguments, it will report
total, used and free disk space on
all mounted regular file systems. It
will report on both local and remote
systems and the % of total disk
space used.
• Use df -HT
MOUNTING FILE SYSTEMS
MANUALLY
A file system residing on a
SATA/PATA or SCSI device
needs to be mounted
manually to access it.
mount allows the root to manually mount a file system.
First argument of mount specifies the file system to mount.
Second argument specifies the target directory where the file system is
made available.
Target directory is referred to as a mount point.
mount expects the file
system argument in one of
two different ways:
The device file of the partition holding the file system, residing in /dev.
The UUID, a universal unique identifier of the file system.
IDENTIFYING THE
BLOCK DEVICE
A hot-pluggable storage device, whether a
hard disk drive (HDD) or solid-state device
(SSD) in a server caddy, or a USB storage
device, might be plugged into a different port
each time they are attached to a system.
lsblk lists the details of a specified block
device or all available devices.
If you want to see the just hard drives like
/dev/sda, etc you can pipe lsblk to grep and
just search for anything that starts with “sd”
In this shot, sdb is a 2nd hard drive that has
been installed but not partitioned, formatted
or mounted yet.
MOUNTING BY BLOCK DEVICE NAME
To mount a file system,
the destination
directory must already
exist. The /mnt
directory exists by
default and is intended
for use as a temporary
mount point.
You can use /mnt
directory, or better yet
create a subdirectory
of /mnt to use as a
temporary mount
point, unless you have
a good reason to
mount it in a specific
location in the file-
system hierarchy.
This approach works
fine in the short run.
the order in which
the operating
system detects disks
can change
this will change the
device name
associated with that
storage device.
A better approach
would be to mount by
some characteristic
built into the file
system.
MOUNTING BY FILE-SYSTEM UUID
One stable identifier that is
associated with a file system is
its UUID
A very long hexadecimal
number that acts as a
universally-unique identifier
UUID is part of the file system
and remains the same as long
as the file system is not
recreated.
lsblk -fp lists the full path of
the device, along with the
UUIDs and mount points, as
well as the type of file system
in the partition.
If the file system is not
mounted, the mount point will
be blank, see how /dev/sdb
has no mount point of / or
anything else yet.
AUTOMATIC
MOUNTING
OF
REMOVABLE
STORAGE
DEVICES
Before removing the device, you should unmount
it manually.
If you are logged in and using the graphical
desktop environment, it will automatically mount
any removable storage media when it is inserted.
removable storage device is mounted at
/run/media/USERNAME/LABEL where USERNAME is the name of
the user logged into the graphical environment and LABEL is an
identifier, often the name given to the file system when it was
created if one is available.
UNMOUNTING
FILE SYSTEMS
The shutdown and reboot
procedures unmount all file
systems automatically. Any file
system data cached in memory is
flushed to the device
umount unmounts the specified file
•Unmounting is not possible if the mount
point is accessed by a process.
lsof lists all open files and the
process accessing them in the
provided directory.
MOUNTING AND UNMOUNTING FILE SYSTEMS
This Photo by Unknown Author is licensed under CC BY-SA-NC
LOCATING FILES
ON THE SYSTEM
This Photo by Unknown Author is licensed under CC BY-SA-NC
find performs a real-
time search as the
current user in the local
file systems to find files
that match the criteria
of the command-line
arguments.
The first argument to the find command is the directory to search. If the
directory argument is omitted, find will start the search in the current directory
and look for matches in any of the subdirectories.
•find has a huge number of options that can be provided to describe exactly what kind of file should be
found. Searches can be based on file name, file size, last modified time stamp, and other file
characteristics in any combination.
locate returns search
results based on file
name or path from the
locate database. The
database stores file
name and path
information.
When searching entries as a regular user, results are returned only for where the
user invoking the locate search has read permissions on the directory tree that
contains the matching element.
The locate database is automatically updated every day. The root user can
perform an update of the database with the updatedb command.
LOCATING FILES ON THE FILE SYSTEM
This Photo by Unknown Author is licensed under CC BY-SA-NC
• Storage devices are represented by a
special file type called block device.
• df reports total disk space, used disk
space, and free disk space on all mounted
regular file systems.
• mount allows the root user to manually
mount a file system.
• All processes need to stop accessing the
mount point in order to unsuccessfully
unmount the device.
• Removable storage devices are mounted in
the /run/media directory when using the
graphical environment.
• The find command performs a real-time
search in the local file systems to find files
based on search criteria.
This Photo by Unknown Author is licensed under CC BY-SA

More Related Content

Similar to CIT173_Ch15_Mnstr_23.pdf

Distributed File System
Distributed File SystemDistributed File System
Distributed File SystemNtu
 
UNIX(Essential needs of administration)
UNIX(Essential needs of administration)UNIX(Essential needs of administration)
UNIX(Essential needs of administration)Papu Kumar
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinalmarangburu42
 
File system Os
File system OsFile system Os
File system OsNehal Naik
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinalmarangburu42
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsMukesh Chinta
 
Disks and-filesystems
Disks and-filesystemsDisks and-filesystems
Disks and-filesystemsplarsen67
 
Disks and-filesystems
Disks and-filesystemsDisks and-filesystems
Disks and-filesystemsplarsen67
 
Big data with HDFS and Mapreduce
Big data  with HDFS and MapreduceBig data  with HDFS and Mapreduce
Big data with HDFS and Mapreducesenthil0809
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answersKalyan Hadoop
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849marangburu42
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 

Similar to CIT173_Ch15_Mnstr_23.pdf (20)

Distributed File System
Distributed File SystemDistributed File System
Distributed File System
 
UNIX(Essential needs of administration)
UNIX(Essential needs of administration)UNIX(Essential needs of administration)
UNIX(Essential needs of administration)
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
 
File system Os
File system OsFile system Os
File system Os
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Posscon2013
Posscon2013Posscon2013
Posscon2013
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinal
 
Linux
LinuxLinux
Linux
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
 
Disks and-filesystems
Disks and-filesystemsDisks and-filesystems
Disks and-filesystems
 
Disks and-filesystems
Disks and-filesystemsDisks and-filesystems
Disks and-filesystems
 
Big data with HDFS and Mapreduce
Big data  with HDFS and MapreduceBig data  with HDFS and Mapreduce
Big data with HDFS and Mapreduce
 
Ch12
Ch12Ch12
Ch12
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
 
Linux passwords class 4
Linux passwords class 4Linux passwords class 4
Linux passwords class 4
 
Edubooktraining
EdubooktrainingEdubooktraining
Edubooktraining
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answers
 
Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849Filesystemimplementationpre final-160919095849
Filesystemimplementationpre final-160919095849
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 

Recently uploaded

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 

Recently uploaded (20)

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 

CIT173_Ch15_Mnstr_23.pdf

  • 1. CIT 173 Introduction to Linux. Instructor Lily Morningstar ACCESSING LINUX FILE SYSTEM This Photo by Unknown Author is licensed under CC BY-NC
  • 2. GOALS: LEARNING OUTCOMES Access, inspect, and use existing file systems on storage attached to a Linux server.
  • 3. IDENTIFYING FILE SYSTEMS AND DEVICES Files on a Linux server are accessed through the file- system hierarchy A single inverted tree of directories. Assembled from file systems provided by the storage devices on your system. Each file system is a storage device that has been formatted to store files.
  • 4. FILE SYSTEM HIERARCHY This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 5. The hierarchy presents a collection of file systems on separate storage devices as if it were one set of files on one giant storage device that you can navigate. Most of the time, you don’t need to know which storage device a particular file is on, you just need to know the directory that file is in. You might need to determine how full a storage device is and what directories in the file-system hierarchy are affected. There might be errors in the logs from a storage device Hard link between two files. HIERARCHY
  • 6. FHS The file system hierarchy assembles all the file systems into one tree of directories with a single root, the / directory
  • 7. MOUNT POINTS, DISK PARTITIONS AND LOGICAL VOLUMES This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 8. FILE SYSTEMS AND MOUNT POINTS Makes the contents of a file system available in the file-system hierarchy Must be mounted on an empty directory (mount point) Once mounted, if you use ls to list that directory, you will see the contents of the mounted file system Many file systems are automatically mounted as part of the boot process. Microsoft Windows drive letters, are a fundamentally different concept. It is somewhat similar to the NTFS mounted folders feature.
  • 9. FILE SYSTEMS, STORAGE, AND BLOCK DEVICES Low-level access to storage devices in Linux is provided by a special type of file called a block device Block devices must be formatted with a file system before they can be mounted. Block device files are stored in the /dev directory Device files are created automatically by the operating system. In Red Hat Enterprise Linux, the first SATA/PATA, SAS, SCSI, or USB hard drive detected is called /dev/sda, the second is /dev/sdb, and so on •represent the entire hard drive •other types of storage will have other forms of naming
  • 10. DISK PARTITIONS Disk Partitions Storage devices are divided up into smaller chunks called partitions. Partitions allow you to compartmentalize a disk Partitions can be formatted with different file systems or used for different purposes. user home directories, system data, logs. If a user fills up the home Partitions are block devices in their own right. SATA-attached storage, the first partition on the first disk is /dev/sda1. Paravirtualized storage devices have a similar naming system. An NVMe-attached SSD device is /dev/nvme0p1.e1p3 A long listing of the /dev/sda1 device file on host reveals its special file type as b, which stands for block device:
  • 11. STORAGE MANAGEMENT CONCEPTS A file system is an organized structure of data-holding files and directories residing on a storage device, such as a physical disk or partition. The advantage of FSH existing hierarchy can be extended at any time by adding a new disk or partition containing a supported file system to add disk space anywhere in the file system tree. The process of adding a new file system to the existing directory tree is called mounting. The directory where the new file system is mounted is referred to as a mount point. This is a fundamentally different concept than that used on a Microsoft Windows system, where a new file system is represented by a separate drive letter. Hard disks and storage devices are normally divided up into smaller chunks called partitions. A partition is a way to compartmentalize a disk. Storage devices are represented by a special file type called block device. The block device is stored in the /dev directory. In Red Hat Enterprise Linux, the first SCSI, PATA/SATA, or USB hard drive detected is /dev/sda, the second is /dev/sdb. This name represents the whole drive. The first primary partition on /dev/sda is /dev/sda1, the second partition is /dev/sda2. A long listing of the /dev/vda device file on serverX reveals its special file type as b, which stands for block device
  • 12. LOGICAL VOLUMES LVM relies on the Device Mapper (DM) kernel driver. The symbolic link /dev/myvg/mylv points to the /dev/dm-number block device node. The assignment of the number is sequential beginning with zero (0). There is a symbolic link for every logical volume in the /dev/mapper directory with the name /dev/mapper/myvg-mylv. Access to the lv can use either of the consistent and reliable symbolic link names /dev/dm-number name can vary with each boot. Volume group and the logical volume have names assigned upon creation. volume group, a directory with the same name as the volume group exists in the /dev directory. below that directory, a symbolic link with the same name as the logical volume has been created. Another way of organizing disks and partitions is with logical volume management (LVM). one or more block devices can be aggregated into a storage pool called a volume group. Disk space is made available with one or more logical volumes. A logical volume is the equivalent of a partition residing on a physical disk.
  • 13. EXAMINING FILE SYSTEMS • To get an overview about the file system mount points and the amount of free space available, run the df command. (Recall you saw this command in Chapter 3.) • When the df command is run without arguments, it will report total, used and free disk space on all mounted regular file systems. It will report on both local and remote systems and the % of total disk space used. • Use df -HT
  • 14. MOUNTING FILE SYSTEMS MANUALLY A file system residing on a SATA/PATA or SCSI device needs to be mounted manually to access it. mount allows the root to manually mount a file system. First argument of mount specifies the file system to mount. Second argument specifies the target directory where the file system is made available. Target directory is referred to as a mount point. mount expects the file system argument in one of two different ways: The device file of the partition holding the file system, residing in /dev. The UUID, a universal unique identifier of the file system.
  • 15. IDENTIFYING THE BLOCK DEVICE A hot-pluggable storage device, whether a hard disk drive (HDD) or solid-state device (SSD) in a server caddy, or a USB storage device, might be plugged into a different port each time they are attached to a system. lsblk lists the details of a specified block device or all available devices. If you want to see the just hard drives like /dev/sda, etc you can pipe lsblk to grep and just search for anything that starts with “sd” In this shot, sdb is a 2nd hard drive that has been installed but not partitioned, formatted or mounted yet.
  • 16. MOUNTING BY BLOCK DEVICE NAME To mount a file system, the destination directory must already exist. The /mnt directory exists by default and is intended for use as a temporary mount point. You can use /mnt directory, or better yet create a subdirectory of /mnt to use as a temporary mount point, unless you have a good reason to mount it in a specific location in the file- system hierarchy. This approach works fine in the short run. the order in which the operating system detects disks can change this will change the device name associated with that storage device. A better approach would be to mount by some characteristic built into the file system.
  • 17. MOUNTING BY FILE-SYSTEM UUID One stable identifier that is associated with a file system is its UUID A very long hexadecimal number that acts as a universally-unique identifier UUID is part of the file system and remains the same as long as the file system is not recreated. lsblk -fp lists the full path of the device, along with the UUIDs and mount points, as well as the type of file system in the partition. If the file system is not mounted, the mount point will be blank, see how /dev/sdb has no mount point of / or anything else yet.
  • 18. AUTOMATIC MOUNTING OF REMOVABLE STORAGE DEVICES Before removing the device, you should unmount it manually. If you are logged in and using the graphical desktop environment, it will automatically mount any removable storage media when it is inserted. removable storage device is mounted at /run/media/USERNAME/LABEL where USERNAME is the name of the user logged into the graphical environment and LABEL is an identifier, often the name given to the file system when it was created if one is available.
  • 19. UNMOUNTING FILE SYSTEMS The shutdown and reboot procedures unmount all file systems automatically. Any file system data cached in memory is flushed to the device umount unmounts the specified file •Unmounting is not possible if the mount point is accessed by a process. lsof lists all open files and the process accessing them in the provided directory.
  • 20. MOUNTING AND UNMOUNTING FILE SYSTEMS This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 21. LOCATING FILES ON THE SYSTEM This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 22. find performs a real- time search as the current user in the local file systems to find files that match the criteria of the command-line arguments. The first argument to the find command is the directory to search. If the directory argument is omitted, find will start the search in the current directory and look for matches in any of the subdirectories. •find has a huge number of options that can be provided to describe exactly what kind of file should be found. Searches can be based on file name, file size, last modified time stamp, and other file characteristics in any combination. locate returns search results based on file name or path from the locate database. The database stores file name and path information. When searching entries as a regular user, results are returned only for where the user invoking the locate search has read permissions on the directory tree that contains the matching element. The locate database is automatically updated every day. The root user can perform an update of the database with the updatedb command.
  • 23. LOCATING FILES ON THE FILE SYSTEM This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 24. • Storage devices are represented by a special file type called block device. • df reports total disk space, used disk space, and free disk space on all mounted regular file systems. • mount allows the root user to manually mount a file system. • All processes need to stop accessing the mount point in order to unsuccessfully unmount the device. • Removable storage devices are mounted in the /run/media directory when using the graphical environment. • The find command performs a real-time search in the local file systems to find files based on search criteria. This Photo by Unknown Author is licensed under CC BY-SA