Linux with Operating System Concepts


partitioned the one SATA hard disk into three file systems



Download 5,65 Mb.
Pdf ko'rish
bet150/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   146   147   148   149   150   151   152   153   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014


partitioned the one SATA hard disk into three file systems.
10.4.2 Viewing the Available File Systems
How do you know which device maps to which partition? There are several different ways 
to determine this. One way is to examine the contents of the /etc/fstab file. This file is the 
file system table, which specifies which partitions should be mounted at system initializa-
tion time. An example of an /etc/fstab file is shown in Figure 10.5. The table stores for each 
partition to be mounted the device’s name, the device’s mount point, the file system type, 
and the mount options. Let us explore these in more detail.
In Figure 10.5, the file system’s device name is given in the first column. Most of the 
entries are stored on a SATA hard disk, which is indicated as /dev/sda#. The individual 
numbers denote different logical devices even though they may be placed on the same 
physical hard disk. In some installations of Linux, the device name is given using a UUID 
specifier, which can look extremely cryptic as it is presented as an address using hexadeci-
mal values.
For a remotely mounted file system, the device name is the name of the remote file sys-
tem’s host and the mount point within that host. In Figure 10.5, we see one example of a 
/dev/sda1
/
ext4
defaults
1 1
/dev/sda5
/home
ext4
defaults
1 2
/dev/sda3
swap
swap pri
=
2000
0 0
/dev/sda2
/var
ext4
defaults
1 3
proc
/proc
proc defaults
0 0
/dev/cdrom
/media/cdrom
auto ro, noauto, user, exec 0 0
tmpfs
/dev/shm
tmpfs defaults
0 0
www.someserver.com:
/home/stuff
/home/coolstuff nfs
rw, sync
0 0
FIGURE 10.5 
/etc/fstab entries.


The Linux File System

407
partition to be mounted remotely, www.someserver.com: /home/stuff. There may also be 
special file systems that are not placed on physical devices. In Figure 10.5, we see two such 
file systems, one for proc and one for tmpfs. tmpfs is the device name for shared memory 
(which is stored in memory as a ramdisk rather than hard disk; see Section 10.5 for details 
on ramdisks). Another file system which might appear is devpts to communicate with 
terminal windows. Not shown here is sysfs, which stores the /sys directory, used for plug-
and-play devices.
The second column in fstab is the mount point. This is the logical location in the file 
system where the file system is made accessible. This will usually be at the top level of the 
Linux file system, that is, a directory under /. There are some occasions where a mount 
point will be placed within a subdirectory. For instance, we might find mount points under 
/usr or under /home. The remotely mounted partition listed in Figure 10.5 will be mounted 
under /home/coolstuff while the cdrom will be mounted under /media/cdrom.
Not all file systems have explicit mount points. The swap file system is one such example. 
The consequences of not having an explicit mount point is that the file system in question 
could not be mounted or unmounted using the typical mount and umount commands 
(covered later in this section). We discussed swap space in Chapter 8 and will refer to it in 
more detail later in this chapter.
The third column in the fstab specifies the file system’s type. These include ext, ext2, 
ext3, ext4, and others. The ext file system is appropriate for either internal or removable 
storage. Today, we do not see ext in use but instead most systems are based on ext2, which 
is far more efficient; ext3, which provides journaling; or ext4, which can accommodate 
very large files (terabytes in size). The term 
journaling
means that the file system tracks 
changes so that the hard disk contents can be rolled back. Other alternatives that are often 
used in a Linux operating system include NFS (the networked file system), JFS (a journal-
ing file system), umsdos (a version of MS DOS for Linux), iso9660 (used for optical disk 
drives), and proc, which is a virtual file system. The idea behind a virtual file system is that 
it is stored in memory instead of on a storage device. The proc file system contains data 
on all running processes. In Figure 10.5, we see the remote file system is of type nfs (net-
worked file system).
The fourth field in fstab for each file system consists of the mount options specified for 
that partition. The defaults option is common and the obvious choice if you do not want 
to make changes. Aside from defaults, you can specify any of a number of options. You 
can specify whether the file system should be mounted at boot time or not using auto and 
noauto, respectively. The option user/nouser specifies whether ordinary users can mount 
the given partition (user) or whether only root can mount it (nouser). The user option is 
commonly used for devices that a user should be able to mount after system initialization 
takes place such as with an optical disk (cdrom) or a USB flash drive.
The exec/noexec option indicates whether binary programs can be executed from the 
partition or not. You might apply noexec if you do not want users to be able to run pro-
grams stored in a particular partition. As an example, we may want to place noexec on 
the /home partition. This would prevent a user from writing a program, storing it in their 
home directory, and executing it from there. Instead, any such program would have to be 


408

Linux with Operating System Concepts
moved to another partition, for instance, /usr. This restriction may be overly cautious if 
we expect our users to write and execute their own programs. But if we do not expect that 
of our users, the precaution could prevent users from downloading executable programs 
into their home directories and executing them. This is a reasonable security measure in 
that we are preventing users from possibly downloading programs that are some form of 
malware.
Two other options are ro versus rw (read-only, read/write) and sync/async. In the former 
case, the ro option means that data files on this partition can only be read. We might use 
this option if the files are all executable programs, as found in /bin and /sbin. Partitions 
with data files such as /var and /home would be rw. The latter option indicates whether files 
have to be accessed in a synchronized way or not. With sync, any read or write operation 
must be completed before the process moves on to the next step. This is sometimes referred 
to as 
blocking I/O
because the process is blocked from continuing until I/O has completed. 
In asynchronous I/O, the process issues the I/O command and then continues on without 
stopping.
The defaults option consists of rw, exec, auto, nouser, and async. Other options are avail-
able. The swap partition has an added option of pri 
=
2000. This is known as a configura-
tion priority. When multiple partitions have a priority, mounting of those partitions is 
handled based on the order of the priority (the higher the number, the higher the priority).
The final column in the fstab file is a sequence of two numbers. This pair of values 
indicates the order by which all partitions will be examined by fsck and the order that the 
Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   146   147   148   149   150   151   152   153   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish