79.

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); }

Book: LPI Linux Certification in a Nutshell
Section: Chapter 10.  Exam 101 Highlighter's Index



10.2 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4)

10.2.1 Objective 1: Create Partitions and Filesystems

10.2.1.1 Disk drives and partitions
  • IDE disks are known as /dev/hda, /dev/hdb, /dev/hdc, and /dev/hdd.

  • SCSI disks are known as /dev/sda, /dev/sdb, /dev/sdc, and so on.

  • Three types of partitions:

    Primary

    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.

    Extended

    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.

    Logical

    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/hda10, and so on.

  • Up to 15 partitions with filesystems may exist on a single physical disk.

10.2.1.2 The root filesystem and mount points
  • 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.

10.2.1.3 Partition and filesystem management commands

The following commands are commonly used to repair and manage filesystems:

fdisk [device]

Manipulate or display the partition table for device using a command-driven interactive text interface. device is a physical disk such as /dev/hda, not a partition such as /dev/hda1.

mkfs device

Make a filesystem on device.

mkswap device

Prepare a partition for use as swap space.

10.2.2 Objective 2: Maintain the Integrity of Filesystems

These commands are commonly used in day-to-day filesystem maintenance:

df [directories]

Display overall disk utilization information for mounted filesystems on directories.

du [directories]

Display disk utilization information for directories.

fsck filesystems

Check filesystems for errors and optionally correct them.

10.2.3 Objective 3: Control Filesystem Mounting and Unmounting

10.2.3.1 Managing the filesystem table
  • /etc/fstab contains mount information for filesystems. Each line contains a single filesystem entry made up of six fields, shown in Table 10-5.

Table 10-5. Fields Found in the /etc/fstab File

Entry

Description

Device

The device file for the partition holding the filesystem.

Mount point

The directory upon which the filesystem is to be mounted.

Filesystem type

A filesystem type, such as ext2.

Mount options

A comma-separated list.

Dump frequency

For use with dump.

Pass number for fsck

Used at boot time.

10.2.3.2 Mounting and unmounting

The following commands are used to mount and unmount filesystems:

mount device

mount directory

mount device directory

Mount filesystems onto the hierarchy. The first and second forms consult /etc/fstab for additional information.

umount device

umount directory

Unmount the filesystem on device or mount it on directory.

10.2.3.3 Filesystem types

Common filesystem types compatible with Linux include:

ext2

The standard Linux filesystem.

iso9660

The standard CD-ROM format.

msdos

The MS-DOS FAT filesystem.

nfs

Remote servers.

proc

The proc filesystem, which is a system abstraction for access to kernel parameters.

swap

Swap partitions.

vfat

Virtual FAT, used instead of msdos.

10.2.4 Objective 4: Set and View Disk Quota

  • Quotas are used to enforce a disk space or an inode maximum on individuals, groups, or both.

  • These types of quota limits can be set:

    Per-user hard

    The maximum size for an individual.

    Per-user soft

    A warning threshold.

    Per-group hard

    The maximum size for a group.

    Per-group soft

    A warning threshold.

    Grace period

    A time restriction on the soft limit.

  • These commands manipulate quotas:

quota user
quota -g group

Display quota limits on user or group.

quotaon [ filesystems]

Enable previously configured disk quotas on one or more filesystems.

quotaoff [ filesystems]

Disable disk quotas on one or more filesystems.

quotacheck [ filesystems]

Examine filesystems and compile quota databases. Usually run via cron.

edquota names

Modify user or group quotas by spawning a text editor.

repquota filesystems

Display a summary report of quota status for filesystems, or use -a for all filesystems:

Enabling quotas requires usrquota and/or grpquota options in /etc/fstab, creation of quota.user and quota.group files at the top of the filesystem, a quotacheck, and a quotaon.

10.2.5 Objective 5: Use File Permissions to Control Accessto Files

10.2.5.1 Access control
  • Access control is implemented using a set of properties called the access mode, stored in the inode. Three classes of user are defined:

    User

    The user that owns the file.

    Group

    The group that owns the file.

    Other

    All other users on the system.

  • Three permissions are either granted or not granted to each class of user:

    Read (r)

    Allows access to file contents and listing of directory contents.

    Write (w)

    Allows writing a file or creating files in a directory.

    Execute (x)

    Allows execution of a file and read/write files in a directory.

  • These comprise nine bits in the mode User rwx, Group rwx, and Other rwx.

  • Three additional mode bits are defined:

    SUID

    To grant processes the rights of an executable file's owner.

    SGID

    To grant processes the rights of an executable file's group.

    Sticky bit

    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.

10.2.5.2 Setting access modes
  • 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:

    chmod mode files

    Modify the access mode on files using a symbolic or octal mode.

10.2.6 Objective 6: Manage File Ownership

  • Access modes are tied to file ownership.

  • Files have both individual and group ownership:

    chown user-owner.group-owner files

    Change the owner and/or group of files to user-owner and/or group-owner.

    chgrp group-owner files

    Change the group ownership of files to group-owner.

  • chgrp functionality is included in chown.

10.2.7 Objective 7: Create and Change Hardand Symbolic Links

  • A link is a pseudonym for another file.

  • Links take very little space in the filesystem.

  • A symbolic link is a tiny file that contains a pointer to another file. Symbolic links can span filesystems.

  • A hard link is a copy of a file's directory entry. Both directory entries point to the same inode and thus the same data, ownership, and permissions.

ln has the following syntax:

ln file link
ln files directory

Create link to file or in directory for all files. Symbolic links are created with the -s option.

10.2.8 Objective 8: Find System Files and Place Filesin the Correct Location

  • The FHS is used by Linux distributions to standardize filesystem layout. It defines two categories of data use, each with opposing subtypes:

    • Data sharing: sharable data can be used by multiple host systems on a network. Non-sharable data is unique to one particular host system.

    • Data modification: variable data is changed continually by naturally occurring (i.e., frequent) processes. Static data is left alone, remaining unchanged over extended periods of time.

  • The FHS seeks to define the filesystem contents in these terms and locate information accordingly.

10.2.8.1 The directory hierarchy
  • The root filesystem:

    • Must contain utilities and files sufficient to boot the operating system, including the ability to mount other filesystems.

    • Should contain the utilities needed by the system administrator to repair or restore a damaged system.

    • Should be relatively small.

  • /usr contains system utilities and programs that do not appear in the /root partition. It includes directories such as /bin, /lib, /local, and /src.

  • /var contains varying data such as printer spools and log files, including directories such as log, mail, and spool.

10.2.8.2 Locating files
  • Various methods can be used to locate files in the filesystem:

    which command

    Determine the location of command and display the full pathname of the executable program that the shell would launch to execute it.

    find paths expression

    Search for files that match expression starting at paths and continuing recursively.

    locate patterns

    Locate files whose names match one or more patterns by searching an index of files previously created.

    updatedb

    Refresh (or create) the slocate database, usually via cron.

    whatis keywords
    apropos keywords

    Search the whatis database for keywords. whatis finds only exact matches, while apropos finds partial word matches.

 


LPI Linux Certification in a Nutshell
LPI Linux Certification in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596005288
EAN: 2147483647
Year: 2000
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net