+ All Categories
Home > Documents > 7 File System

7 File System

Date post: 03-Apr-2018
Category:
Upload: benyfirst
View: 225 times
Download: 0 times
Share this document with a friend

of 20

Transcript
  • 7/29/2019 7 File System

    1/20

    1

    7

    The Linux Filesystem

    Terms youll need to understand:

    mknod

    fdisk

    mkfs

    df

    du

    fsck

    Inode

    ln

    mount

    umount

    quotaon

    quotaoff

    edquota

    repquota

    Quota

    quotacheck

    quotastats

    locate

    updatedb

    which

    find

    xargs

    Techniques youll need to master:

    Understanding how the standard

    Linux directories are arranged andthe purpose for each

    Recognizing the core utilities used

    for interaction with the disk

    923_2C07.p65 11/16/00, 2:46 PM1

    2Chapter 7

    In this chapter, youll learn of the standard disk layout and the utilities used to

    manage and alter disks. Directories, subdirectories, and files have been major

    topics throughout this book, and now it is time to elaborate on them by discuss-

    ing the purpose and default content of each.

    The Standard Disk LayoutThe Linux installation created a number of directories to hold system files. Any

    normal installation, regardless of the vendor, creates the file structure depicted in

    Figure 7.1.

    The following sections discuss each of the directories.

    The / directoryEverything begins at the root directory (/).The root is the directory from which

    everything else becomes a subdirectory or subcomponent. When specifying loca-

    tions using absolute addressing, you always begin with this directory because it is

    the ultimate origin, and it is impossible to move any further back since there is no

    directory above it.

    The bin directoryThe bin directory holds the binaries (executables) that are essential to using the

    Linux operating system. Many of the utilities discussed so far are located in thebin directory, including:

    cat

    cp

    date

    ls

    mkdir

    mv

    ps

    sed

    As a rule of thumb, the executable or binary files located within this directory

    are available to all users. Binary files that are not critical to the operation of

    the system, or that are needed by all users, commonly appear in /usr/bin in-

    stead of here.

    923_2C07.p65 11/16/00, 2:46 PM2

  • 7/29/2019 7 File System

    2/20

  • 7/29/2019 7 File System

    3/20

  • 7/29/2019 7 File System

    4/20

  • 7/29/2019 7 File System

    5/20

  • 7/29/2019 7 File System

    6/20

  • 7/29/2019 7 File System

    7/20

  • 7/29/2019 7 File System

    8/20

  • 7/29/2019 7 File System

    9/20

  • 7/29/2019 7 File System

    10/20

  • 7/29/2019 7 File System

    11/20

  • 7/29/2019 7 File System

    12/20

  • 7/29/2019 7 File System

    13/20

  • 7/29/2019 7 File System

    14/20

  • 7/29/2019 7 File System

    15/20

  • 7/29/2019 7 File System

    16/20

  • 7/29/2019 7 File System

    17/20

  • 7/29/2019 7 File System

    18/20

    35The Linux Filesystem

    Practice Questions

    Question 1

    Which file updates the database that the locate command uses to find

    matches for search names?

    a. locatedb

    b. fstab

    c. mtab

    d. updatedb

    The correct answer to this question is d. Theupdatedbutility updates the data-

    base. Answer a is the name of the database thelocateutility uses to find the files,

    so it is incorrect. Answer b is the file system table, and answer c is the mount

    table, neither of which relate to the locate utility.

    Question 2

    Which of the following files would be read by the commandmount -a? a. /etc/mtab

    b. /etc/fstab

    c. /etc/update.conf

    d. /etc/mount

    The correct answer to this question is b. The fstab file holds information about

    the filesystems known to it. Answer a/etc/mtabis where entries are written

    when the filesystems are loaded, so it is incorrect. The other two choices are

    invalid in relation to the question.

    923_2C07.p65 11/16/00, 2:46 PM35

    36 Chapter 7

    Question 3

    You want to start using quotas on the third partition of your systems disk. To

    begin, you must edit the fstab file. To which field must you add theusrquota

    entry?

    a. First

    b. Second

    c. Third

    d. Fourth

    e. Fifth

    f. Sixth

    The correct answer to this question is d. You must add the entry to the fourth

    field of the entry for the quotas to be invoked.

    Question 4

    What is the syntax to use to create a symbolic link named advise to a file

    in the same directory named please? [Fill in the blank]

    _______________

    The correct answer to this question is:

    l n - s pl ease advi se

    923_2C07.p65 11/16/00, 2:46 PM36

  • 7/29/2019 7 File System

    19/20

    37The Linux Filesystem

    Question 5

    Which of the following locations could contain the kernel? [Check all cor-

    rect answers]

    a. /

    b. /bin

    c. /boot

    d. /etc

    The correct answers to this question are a and c. The default location for the

    kernel, which differs according to vendors and versions, is either root (/) or /boot.

    The /bin directory (choice b) holds executable files for all users, while the /etc

    directory (choice d) is used to hold configuration files; hence, these two choices

    are incorrect.

    Question 6

    Which of the following options can you use with the findutility to prompt a

    user before carrying out an operation?

    a. -exec b. -query

    c. -ok

    d. -perm

    The correct answer to this question is c, which prompts you before carrying out

    an action. Answer a executes the same operation without first prompting the

    user; answer b is not an option for find; and answer d locates only files that meet

    the specified permissions.

    923_2C07.p65 11/16/00, 2:46 PM37

    38 Chapter 7

    Question 7

    You are getting ready to begin system-administration tasks on your system.

    Before starting anything, you want to compile a list of utilities that are avail-

    able only for this purpose (adding users, groups, and so on). Which directory

    contains the entries you are seeking?

    a. /usr/sbin

    b. /usr/bin

    c. /sbin

    d. /bin

    The correct answer to this question is a. The /usr/sbin directory holds system-

    specific administrative binaries for use by the administrator. Answer b is used by

    all users, so it is incorrect. Answer c holds system utilities, but most are available

    for system purposes other than adding users and groups, such as formatting, check-

    ing the file systems, and so on; therefore, it is incorrect. Answer d is used by all

    users, so it is incorrect.

    Question 8

    On a SCSI hard drive, which of the following indicates the third partition on

    the second disk?

    a. hba3

    b. sba3

    c. sdb3

    d. hdc2

    The correct answer to this question is c. Thesindicates the type of disk, which is

    SCSI; thed indicates the type of device, which is disk; theb indicates the second

    disk; and the3 indicates the third partition.

    923_2C07.p65 11/16/00, 2:46 PM38

  • 7/29/2019 7 File System

    20/20

    39The Linux Filesystem

    Question 9

    Which utility can you use to format a partition?

    a. format

    b. fdisk

    c. mkfs

    d. mount

    The correct answer to this question is c. You use themkfsutility to format apartition. Answer a does not exist in L inux, so it is incorrect. Answer b, fdisk,

    creates partitions, so it is incorrect. And answer d is used to load a remote filesystem,

    so it is incorrect.

    Question 10

    Thefsck utility has found a number of corrupted files, and you have chosen

    to correct the filesystem. To which directory are the corrupted files written?

    a. lost+found

    b. tmp

    c. etc

    d. /

    The correct answer to this question is a. The /lost+found directory holds the

    corrupted files. Usually they are so corrupted that their names are no longer known,

    and thus the files are written here by inode number. The /tmp directory (answer

    b) holds temporary files that do not need to survive a reboot. The /etc directory

    (answer c) hold configuration files used by the system, while the root directory

    (answer d) is the starting point of all subdirectories.

    923_2C07.p65 11/16/00, 2:46 PM39

    40 Chapter 7

    Need to Know More?/usr/src/linux/Documentation/devices.txt describes many of the en-

    tries in the /dev directory.

    www.linuxdoc.org/HOWTO/mini/Quota.html defines quotas and

    explains their requirements within Linux. The site addresses setup and

    configuration details, as well as corresponding utilities.

    www.linuxdoc.org/HOWTO/Filesystems-HOWTO.html is not

    specifically limited to L inux (it includes NT FS and other filesystems),

    but it fully explains the Extended Filesystems (ext2 and so on) in the

    sixth section of the document.

    @@@insert documentation icon??? is this the same

    as the book icon?????@@@

    923_2C07.p65 11/16/00, 2:46 PM40


Recommended