partition that contains user home directories?
20. The /proc directory will reside on its own partition of type proc. Why does this parti-
tion not have a similar type as most of the rest of the file system (e.g., ext4)?
21. You want to find out how much of a particular partition has been filled, that is, how
much of its capacity still remains. Which instruction might you use: stat, ls, du, df, or
fsck?
The Linux File System
◾
441
22. Examine the file /etc/fstab. You will find that most entries have in their last column
0 0. What partitions have numbers other than 0 0? What do the numbers mean?
23. What is the difference between the contents of /etc/fstab and /etc/mtab?
24. Assume that /home has been unmounted. /home is stored physically on the device
/dev/sda3. Write the appropriate command to remount /home.
25. What happens if you issue the command
mount –a
?
26. What service do you need to start in order to mount a remote partition over the
network?
27. You want to mount a remote partition over the network. Would you need to run
exportfs?
28. The following entry is found in the /etc/exports file. What does it mean?
/usr/bin/somestuff 10.11.0.0/16(ro,sync)
29. As the system administrator you want to unmount /home so that you can perform
a backup. After issuing
umount /home
, you are told that the device is busy. Why
might this happen?
30. What is the role of the parted instruction?
31. What advantages would an LVM have over specifying partitions during Linux
installation?
32. If we were to use an LVM to provide our file system partitioning, why would /boot
remain as a physical partition?
33. Assume that you have two disk drives each containing 1 TB. From these two drives, you
create two physical partitions, /boot and volumegroup1. The /boot partition is 128 MB.
Assume that a physical extent is 8 MB. How many PEs are available for your LVM?
34. In order to establish a disk quota for users, you must specify that the _________
should have an option of usrquota. Should the blank be filled in with device name,
file system name, directory name, or user name?
35. Before issuing the instruction quotacheck, you should make sure that the file system
is unmounted. If it is not, what option might you use on quotacheck?
36. What is meant by a soft limit versus a hard limit?
37. How can you establish a soft limit’s grace period?
38. What is the role of the file aquota.user?
39. What is the drawback of the edquota instruction that the setquota instruction might
be preferred?
442
◾
Linux with Operating System Concepts
40. Imagine that we have three categories of user. Users under category 1 have no quota
restrictions. Users under category 2 have no inode restrictions but block restrictions
of 4096 for a soft limit and 5400 for a hard limit. Users under category 3 have restric-
tions of 4096/5400 for blocks and 200/250 for inodes (soft/hard limits). Write a shell
script that will read from a text file all of the users and their category, 1, 2, or 3 and
establish the proper quota for each user. The username and category are the only two
items found on a line, and each user is on a separate line of the text file.
41. Write a script, similar to the one presented near the end of Section 10.4.7, which will
input from a text file a list of user names along with a soft limit and a hard limit for
blocks. Then set for this user a disk quota based on those limits. There will be no limit
for inodes. The file system will be /home.
42. Alter your script from question #41 so that you input a user name, a string, and two
numbers. The string will be either block or inode and the two numbers will then
reflect the soft and hard limit on blocks or inodes for the given user.
43. Explore the contents of /bin and /usr/bin. Under which of these directories would you
find all of the common file system commands (ls, cp, rm, etc.)?
44. Examine /usr/bin. List five commands (programs) that you have learned to this point
of the textbook that are found in this directory.
45. Explore the contents of /sbin and /usr/sbin. In general, which of these directories
contains more programs that you are familiar with?
46. Why should /root have a home directory separate from /home?
47. Examine your /proc directory and you will find subdirectories whose names are num-
bers. Each of these is a running process. The number is that process’ PID. You can
count the number of running processes using
ps aux | wc –l
. Come up with a
command to count the number of numbered subdirectories (do not count subdirecto-
ries that are not numbered as these are not processes). You might find the count differs
by one as the ps command itself is listed and therefore was counted in the wc com-
mand even though the ps command terminates before the output appears. What com-
mand did you come up with to count the number of numbered /proc subdirectories?
48. Under /proc, you will find subdirectories for all running processes. Each one of these
subdirectories contains a file called cmdline. What does this file store? Examine some
of these files of processes with small PIDs. Why do they not have values? Examine
some of these files of processes with large PIDs. Do they have values? What can you
infer about whether a process will have a value for cmdline or not?
49. The file /dev/null is like a trash can. You can dump items to it and those items disap-
pear. Perform the following two operations as root:
cp /etc/passwd /dev/null
echo Hello
>>
/dev/null
Does /dev/null change?
The Linux File System
◾
443
50. What is the purpose of the /lost
+
found directory?
51. As a system administrator, you plan on temporarily mounting a remote partition so
that you can copy material into /usr. Where would you mount this partition and why?
52. Provide an argument for installing third-party software in /opt. Provide an argument
for installing third-party software in /usr/bin.
53. Examine the shell script in Section 10.6.1. You will find this instruction:
size
=
‘du –s $item | awk '{print $1}'‘
Why is the awk statement needed? Write this script in vi and try to run it with only
the instruction
size
=
‘du –s $item‘
What happens? Why?
54. Write a tar command to create an archive of all of the contents in /home. Call the file
home.tar. What command did you come up with?
55. Provide two examples of how you might use tar aside from performing a tape
backup.
445
C h a p t e r
11
System Initialization
and Services
T
his chapter’s learning objectives are
• To understand the boot process and why it is necessary
• To understand how the Linux kernel initializes
• To understand the init process and the Linux startup scripts
• To understand the role of the runlevel in Linux and the startup of services given the
runlevel
• To understand the roles and types of the Linux services
• To be able to control services through the GUI and command line
• To know how to configure services through GUI tools and configuration files
11.1 INTRODUCTION
The Linux boot and initialization process is well established. It is largely automated requir-
ing little to no system administrator interaction. However, there are reasons for learning
the process. If something goes wrong, understanding the process will help you trouble-
shoot and resolve any issues. There are some aspects of system initialization that the sys-
tem administrator may wish to tailor to the needs of the organization. Additionally, if the
system is a dual booting one, understanding the boot process becomes critical.
Services are programs run by the operating system in the background to handle requests
of various agents on demand. Services are configured by the administrator and the admin-
istrator is able to start or stop services as needed. Services cover a full range of activities,
including scheduling, logging, network communication, file system communication, device
446
◾
Linux with Operating System Concepts
interaction, and power management. Although many services are initially configured, you
might find it necessary to refine the configuration files.
It may seem odd to couple these two topics into one chapter. However, the two are related
in that during system initialization one of the startup scripts is responsible for starting ser-
vices. And so in this chapter, we first examine the boot and system initialization processes,
ending with the starting of system services. We then examine many of the services in
detail to see what they do and how to configure them.
11.2 BOOT PROCESS
The boot process is necessary because any computer relies on the operating system to pres-
ent an interface to the user. The operating system is responsible for interpreting user com-
mands and when those commands involve running programs, it is the operating system
that must locate the executable program in the file system and load it into memory so that
it can begin execution. So the operating system must itself be loaded into memory and run-
ning before a user can use the computer to load and run programs.
11.2.1 Volatile and Nonvolatile Memory
The operating system is loaded into random access memory (RAM) memory. RAM is
Do'stlaringiz bilan baham: |