directory [command]
The
command(s)
listed are executed with
directory
as the root level of the file system that
the command(s) is able to access. We might start our Apache web server (whose controlling
service is called apachectl) as
chroot /usr/local/apache2 apachectl start
In the above instruction,
apachectl
is the command with a parameter of
start
,
and /
usr/local/apache2
is the root of file system to be isolated. There are only a few
options available for chroot, including userspec and groups to indicate the user and/or
groups to use for the root of the isolated file system.
436
◾
Linux with Operating System Concepts
10.7 CHAPTER REVIEW
Concepts and terms introduced in this chapter:
• Block—fixed-sized unit of storage in the file space. Typically, files are broken into
blocks and distributed across the hard disk surfaces.
• Block device—type of device, denoted by type ‘b’ in a long listing, that performs input/
output on blocks (rather than characters); most storage devices are block devices.
• Character device—type of device, denoted by type ‘c’ in a long listing, that performs
input/output on characters (rather than blocks); keyboard and mouse are examples
of character devices.
• Directory—organizational unit to house files and subdirectories; denoted by ‘d’ in a
long listing.
• Domain socket—a mechanism to support interprocess communication; denoted by
‘s’ in a long listing.
• ext (extended file system type)—family of file systems supported by Linux; ext is not
used but ext2, ext3, and ext4 are all common (moreso ext4 today).
• FAT (file allocation table)—used in older Windows operating systems to store the
disk block layout so that obtaining the ith block of a file can be easily determined
without having to perform i-1 disk accesses.
• FIFO—first-in-first-out, an expression used to describe how elements waiting in a
queue are serviced; in Linux, a fifo is a named pipe.
• File space—the collection of devices used for storage; typically consisting of an inter-
nal hard disk, optical disks, and USB drives mounted as needed and possibly exter-
nally connected hard disk drives or hard disk drives accessed remotely by network.
• File system—the storage structure of a partition, including a specific type.
• File type—Linux denotes file types to differentiate between regular files, directories,
symbolic links, block devices, character devices, named pipes, and domain sockets;
the file type is indicated as the first letter of the permissions in a long listing and can
also be obtained using the stat command.
• Hard link—the name of the file and its inode number. Two files that are hard linked
together permit access to the file via either link. Deleting one “file” deletes a hard
link but not the file. Only if no other hard links exist will the deletion of the last
remaining hard link cause the file to be deleted, returning the inode to the file sys-
tem for reuse.
• Index—a means of indicating where a disk block is to be found; a mapping process
is required to convert from a file’s disk block i to the location on disk of that block.
The Linux File System
◾
437
• Indirect block—inodes come with several direct pointers to the first group of disk
blocks for the file; the remainder of the disk blocks are pointed to by pointers in
indirect blocks; the inode has pointers to indirect blocks, doubly indirect blocks and
triply indirect blocks.
• inode—a data structure storing information about a specific file including pointers to
its blocks or indirect blocks, creation/modification/access information, permissions,
ownership, file type, and device number; any Linux file system contains a set number
of inodes.
• Link—either a hard link or a symbolic link.
• Logical volume manager (LVM)—a software means of partition management so that
partition sizes can be changed without requiring direct changes to the file system
itself; this makes partition management safer and easier.
• Mounting—making a partition available.
• Mount options—control access to the partition such as making it readonly (ro) or
read/write (rw), synchronous (sync) or asynchronous (nosync) and permitting any-
one to mount the partition (user) or not (nouser), among others.
• Mount point—the logical location of a mounted partition, this will be some directory
such as /opt, /mnt, or /usr/local/mountpoint.
• Named pipe—a mechanism to link the output of one process with the input to
another, like a Bash pipe, but in this case the named pipe persists as a file-like object.
• Network file system (nfs)—a form of file system that permits mounting of partitions
over the network.
• Partition—a logical division of the file system to protect the contents from other
partitions.
• Physical extent (PE)—a fixed-sized unit of storage allocated to a logical volume on
demand through LVMs.
• Pointer—an indicator of where a disk block is located.
• Quota—a limit established by the system administrator on the number of blocks (or
inodes) that a given user or group is permitted to use.
• Remote file system—a partition that is made available over the network.
• Symbolic (soft) link—a pointer to a hard link. The symbolic link takes up less space in
a directory than a hard link as it just stores a pointer and not the file’s name. Deleting
the original file will leave the symbolic link pointing to an inode of a nonexistent file.
Soft links are indicated in a long listing with the letter ‘l’ as the file’s type, its name
listed differently, pointing the name and the actual location of the file, such as an
entry like
link-
>
/usr/local/bin/someprogram
.
438
◾
Linux with Operating System Concepts
• Top-level Linux directories—standardized directories that you would find in any
Linux operating system.
• Unmounting—removing a partition from being accessible; you would do this if you
had to work on the partition, for instance, to perform a backup or repair bad blocks.
Linux commands covered in this chapter:
• badblocks—locate bad blocks within a particular device or partition.
• chroot—run the given application(s) within the specified file system as if the file system
were the root level so that the application(s) cannot access outside of the file system.
• cpio—backup utility.
• df—report on file system usage (amount available, amount used) for all or given
Do'stlaringiz bilan baham: |