Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
IDE disks are known as
/dev/hda
,
/dev/hdb
,
/dev/hdc
,
/dev/hdd
, and
so on.
Any disks using the SCSI emulation layer are known as
/dev/sda
,
/dev/sdb
,
/dev/sdc
, and so on. These include SCSI
disks, SATA disks, and, in newer kernels, IDE disks.
Three types of partitions:
Filesystem container. At least one must exist, and up
to four can exist on a single physical disk. They are
identified with numbers 1 to 4, such as
/dev/hda1
,
/dev/hda2
, and so on.
A variant of a primary partition, but it
cannot contain a filesystem. Instead, it contains one or
more
logical partitions
. Only one
extended partition may exist, and it takes one of the four
possible spots for primary partitions.
Created
within
the
extended partition. From 1 to 12 logical partitions may be
created. They are numbered from 5 to 16, such as
/dev/hda5
,
/dev/hda6
, and so on.
Up to 15 partitions with filesystems may exist on a single
physical disk.
The Linux kernel supports many different kinds of
filesystems:
The third extended filesystem. A journaling
filesystem, this has been the default for most Linux
distributions since the early 2000s.
The second extended filesystem. This was the initial
default Linux filesystem.
ext3
is
basically
ext2
with journaling
support.
Journaling filesystem created by Silicon Graphics for
IRIX and ported to Linux.
This was the first journaling filesystem introduced in
the standard Linux kernel.
A Microsoft Windows filesystem for Windows 95, 98, and
ME systems.
The top of the filesystem tree is occupied by the
root filesystem
. Other filesystems are
mounted under it, creating a unified filesystem.
/etc
,
/lib
,
/bin
,
/sbin
, and
/dev
must be part of the root
filesystem.
The following commands are commonly used to repair and manage
filesystems:
device]
Manipulate or display the partition table fordevice
using a command-driven
interactive text interface.device
is
a physical disk such as
/dev/hda
, not a
partition such as
/dev/hda1
.
device
Make a filesystem ondevice
,
which must be a partition.
device
Prepare a partition for use as swap space.
directories
]Display overall disk utilization information for
mounted filesystems ondirectories
.
directories
]Display disk utilization information fordirectories
.
filesystems
Checkfilesystems
for errors
and optionally correct them.
filesystem
Display the detailed information about the
ext2
or
ext3
filesystem atfilesystem
.
filesystem
Modify filesystem variables for the
ext2
or
ext3
filesystem atfilesystem
.
/etc/fstab
contains mount
information for filesystems. Each line contains a single
filesystem entry made up of six fields, shown in
Table 10-11
.
The
/media
directory is often used by
distributions as a place to automount hotplug devices, such as USB
drives.
Table 10-11. Fields found in the /etc/fstab file
Entry | Description |
---|---|
Device | The device file for the |
Mount point | The directory upon which the |
Filesystem type | A filesystem type, such as |
Mount options | A comma-separated |
Dump frequency | For use with |
Pass number for | Used at boot |
The following commands are used to mount and unmount
filesystems:
device
directory
device
directory
Mount filesystems onto the hierarchy. The first and second
forms consult
/etc/fstab
for additional
information.
device
directory
Unmount the filesystem ondevice
or mount it ondirectory
.
Common filesystem types compatible with Linux include:
The standard Linux filesystem.
A journaling filesystem that is backward-compatible with
ext2
.
The standard CD-ROM format.
The Microsoft Windows FAT filesystem.
Remote servers.
A system abstraction for access to kernel
parameters.
Swap partitions.
The maximum size for an individual.
A warning threshold.
The maximum size for a group.
A warning threshold.
A time restriction on the soft limit.
user
group
Display quota limits onuser
orgroup
.
filesystems
]Enable previously configured disk quotas on one or morefilesystems
.
filesystems
]Disable disk quotas on one or morefilesystems
.
filesystems
]Examine filesystems and compile quota databases. Usually
run via
cron
.
names
Modify user or group quotas by spawning a text
editor.
filesystems
Display a summary report of quota status forfilesystems
, or use
-a
for all
file
systems.
Enabling quotas requiresusrquota
and/orgrpquota
options in
/etc/fstab
, creation of
quota.user
and
quota.group
files at the top of the filesystem, a
quotacheck
, and a
quotaon
.
Access control is implemented using a set of
properties called the
access mode
, stored in
the inode. Three classes of user are defined:
The user who owns the file.
The group that owns the file.
All other users on the system.
Three permissions are either granted or not granted to each
class of user:
r
)Allows access to file contents and listing of
directory contents.
w
)Allows writing a file or creating files in a
directory.
x
)Allows execution of a file and ability to read/write
files in a directory.
These comprise nine bits in the mode Userrwx
, Grouprwx
, and Otherrwx
.
Three additional mode bits are defined:
To grant processes the rights of an executable file’s
owner.
To grant processes the rights of an executable file’s
group.
Prohibits file deletion by nonowners.
These 12-mode bits are often referred to in octal notation
as well as with mnemonic constructs.
Mode bits are displayed using such commands as
ls
and
stat
.
New files receive initial access mode as described by the
umask
.
The
umask
strips specified bits from
the initial mode settings. Typical umasks are 002 and 022.
Existing file modes are changed using
chmod
with either symbolic or octal mode
specifications:
Symbolic:
[ugoa][-+=][rwxXst]
Octal bits:
user r, w, x, group r, w, x, other r, w, x
rwxrwxrwx = 111111111 = 777
rwxr-xr-- = 111101100 = 751
chmod
uses the following
syntax:
mode
files
Modify the access mode onfiles
using a symbolic or octalmode
.
user-owner
.
group-owner
files
Change the owner and/or group offiles
touser-owner
and/orgroup-owner
.
group-owner
files
Change the group ownership offiles
togroup-owner
.
chgrp
functionality is included in
chown
.