Guide to Linux+
ISBN 0-619-21621-2
End of Chapter Solutions
Chapter 6 Solutions
Review Questions
-
You find that a device file in the /dev directory has become corrupted. You know that this device is /dev/tty3 and that it is a character device file. What should you do?
-
Use the fsck command to repair the file.
-
Use the mknod command to re-create the file.
-
Use the /dev/MAKEDEV command to re-create the file.
-
Nothing; without the minor number, you cannot re-create the file.
Answer: c
-
After a partition on a hard disk drive is formatted with a filesystem, all partitions on that hard disk drive must use the same filesystem. True or False?
Answer: False
-
You want to see the filesystems that are presently in use on the system. What command could you use?
-
cat /etc/fstab
-
ls -l /etc/fstab
-
cat /etc/mtab
-
ls -l /etc/fstab
Answer: c
-
Jim has just purchased two new SCSI hard disk drives and a controller card for them. He properly installs the hardware in his machine. Before he can use them for data storage and retrieval, what must he do? (Choose all that apply.)
-
Mount the two hard drives so they are accessible by the operating system.
-
Mount a filesystem to each of the hard disk drives.
-
Use the fdisk command to create one or more partitions on each of the hard disk drives.
-
Use the vi editor to edit /etc/mtab and create an entry for the controller card and the hard disk drives.
-
Mount any partitions created on the two hard drives such that they are accessible by the operating system.
-
Format any partitions created with a valid filesystem recognized by Linux.
Answer: c,e,f
-
Given the following output from /etc/fstab, which filesystems will be automatically checked on boot by the fsck command?
-
LABEL=/ / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 1 0
none /proc proc defaults 0 1
none /dev/shm tmpfs defaults 1 0
/dev/hdc2 swap swap defaults 0 1
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
-
-
none, as fsck must be run manually for each filesystem
-
/, /dev/pts and /dev/shm
-
/, /proc and swap
-
all of them, as fsck is run automatically at boot for all filesystems
Answer: b
-
A user mounts a device to a mount point directory and realizes afterward there are files previously found within the mount point directory that are needed. What should this user do?
-
Nothing; the files are lost and cannot ever be accessed.
-
Nothing; the files could not have been there as you can only mount to empty directories.
-
Unmount the device from the directory.
-
Run the fsck command to recover the file.
-
Look in the lost+found directory for the file.
Answer: c
-
Which command is used to display the amount of free space that exists on a filesystem?
-
fsck
-
quota
-
du
-
df
Answer: d
-
What must you do to successfully run the fsck command on a filesystem?
-
Run the fsck command with the -u option to automatically unmount the filesystem first.
-
Choose yes when warned that running fsck on a mounted filesystem can cause damage.
-
Unmount the filesystem.
-
Ensure that the filesystem is mounted.
Answer: c
-
Character devices typically transfer data more quickly than block devices. True or False?
Answer: c
-
What does the du /var command do?
-
shows the users connected to the /var directory
-
shows the size of all directories within the /var directory
-
dumps the /var directory
-
displays the amount of free space in the /var directory
Answer: d
-
What does the command dumpe2fs –h do?
-
backs up an ext2 filesystem
-
displays the number of inodes used and available in an ext2 filesystem
-
dumps an ext2 filesystem
-
is not a valid command
Answer: b
-
The first floppy drive on the system is not responding. You enter the file /dev/fd0 command and receive the following output. What is the problem?
-
[root@server1 root]# file /dev/fd0
/dev/fd0: ASCII text
[root@server1 root]#
-
-
The floppy drive cable has come loose.
-
There is no floppy disk in the drive.
-
The device file has become corrupt.
-
The floppy drive is seen as a character device.
Answer: c
-
Which of the following statements are true? (Choose all that apply.)
-
Quotas can only limit user space.
-
Quotas can only limit the number of files a user can own.
-
Quotas can limit both user space and the number of files a user can own.
-
Hard limits can never be exceeded.
-
Hard limits allow a user to exceed them for a certain period of time.
-
Soft limits can never be exceeded.
-
Soft limits allow a user to exceed them for a certain period of time.
-
Either a hard limit or a soft limit can be set, but not both concurrently.
Answer: c,d,g
-
A device file _______________________. (Choose all that apply.)
-
has no inode section
-
has no data section
-
has no size
-
displays a major and minor number in place of a file size
-
has a fixed size of 300 kilobytes
Answer: b,d
-
If the filesystem type is not specified with the mkfs command, it _________________.
-
prompts the user for the filesystem to use
-
displays a help screen detailing its usage
-
uses the ext3 filesystem by default
-
uses the ext2 filesystem by default
Answer: d
-
Hard disk drives need to be partitioned even if all space on the entire hard drive will be used and configured with one filesystem. True or False?
Answer: True
-
What happens if you type mount /mnt/floppy?
-
The system responds with a message prompting for more information.
-
The system responds with a message that the command failed due to missing parameters.
-
The command succeeds because a line with the necessary parameters exists in /etc/fstab.
-
The command succeeds because a line with the necessary parameters exists in /etc/mtab.
Answer: c
-
Which command mounts all existing filesystems in /etc/fstab?
-
mount -f
-
mount -a
-
mount /etc/fstab
-
mount /etc/mtab
Answer: b
-
A user runs the fsck command with the -a option on a filesystem that is showing signs of corruption. How would that user locate any files the system was unable to repair?
-
Look in the root of the filesystem.
-
The system prompts the user for a target location when it comes across a file it cannot repair.
-
Mount the filesystem and check the lost+found directory underneath the mount point.
-
View the contents of the directory /lost+found.
Answer: c
-
Which command is used to format a partition on a hard disk drive?
-
format
-
none, because the hard disk drive and not the partition must be formatted
-
mkfs -t type device
-
makeFS –type device
Answer: c
Hands-on Projects
Project 6-1
Step 1: Not available.
Step 2: The 6th local terminal; it is a character device because it does not contain a filesystem; major number=4, minor number=6.
Step 3: Yes.
Step 4: INIT is respawning too fast.
Step 5: mknod re-created the tty6 device file; /dev/MAKEDEV can be used instead to do the same.
Step 6: The tty6 file exists again.
Step 7: The major number is the same for all terminal devices because they share the same device driver in the kernel; however, the minor number is different to represent the different terminal devices.
Step 8: There are many files in the /dev directory; however, these files use less than 300K in total.
Step 9: ttyS has a major number of 4.
Step 10: Not available.
Project 6-2
Step 1: Not available.
Step 2: Not available.
Step 3: Without a floppy disk, you receive an error message stating that /dev/fd0 is not a valid device.
Step 4: Yes.
Step 5: The lost+found directory is in the /mymount directory; the hosts file has been covered up by the system.
Step 6: Yes.
Step 7: The hosts file is present in the /mymount directory; the inittab file was copied to the floppy.
Step 8: /mnt/floppy.
Step 9: Not available.
Step 10: The inittab file is on the floppy disk; you cannot unmount a floppy disk while there are users using the directory.
Step 11: The root user; no.
Step 12: Not available.
Step 13: Not available.
Project 6-3
Step 1: Not available.
Step 2: Not available; depends on configuration.
Step 3: Yes.
Step 4: Not available.
Step 5: Yes.
Step 6: /mnt/cdrom.
Step 7: Not available.
Step 8: Not available.
Step 9: Not available.
Step 10: GNOME.
Step 11: The CD-ROM was automatically mounted; yes.
Step 12: Not available.
Step 13: Not available.
Project 6-4
Step 1: Not available.
Step 2: Not available.
Step 3: /dev/hda1 and /dev/hda2.
Step 4: Not available.
Step 5: Linux.
Step 6: t.
Step 7: Not available.
Step 8: Not available.
Step 9: Not available.
Step 10: Not available.
Step 11: Not available.
Step 12: Yes.
Step 13: Not available.
Step 14: Not available.
Step 15: Yes.
Step 16: Yes, the conversion does not affect the files—it only creates a journal file.
Step 17: Not available.
Step 18: Not available.
Step 19: Not available.
Step 20: Yes; it was mounted at boot time via an entry in /etc/fstab.
Step 21: Not available.
Step 22: Yes; the mount –a command mounts all entries from /etc/fstab.
Step 23: Not available,
Project 6-5
Step 1: Not available.
Step 2: / and /newmount; the swap partition is not mounted and unavailable to the df command.
Step 3: Not available; depends on the size.
Step 4: You must unmount the filesystem before running fsck.
Step 5: Not available.
Step 6: A few seconds; only a short check was performed.
Step 7: Longer than a few seconds; a full check was performed.
Step 8: Displays a progress bar while checking.
Step 9: Checks the filesystem for bad blocks and updates the badblocks table.
Step 10: Yes, because it is journaling, it does not need to be checked for errors frequently.
Step 11: Not available.
Step 12: Not available.
Step 13: Not available.
Step 14: Not available.
Step 15: There are eight errors.
Step 16: Not available.
Project 6-6
Step 1: Not available.
Step 2: Not available.
Step 3: Not available.
Step 4: Not available.
Step 5: Not available.
Step 6: Not available.
Step 7: Not available.
Step 8: Not available.
Step 9: Not available.
Step 10: Not available.
Step 11: Not available.
Step 12:It updates the quota database files; you should see the aquota.user and aquota.group files.
Step 13: Not available.
Step 14: No; 400 inodes, 60000K.
Step 15: Not available.
Step 16: Not available.
Step 17: Not available.
Step 18: Yes.
Step 19: The same as Step 16.
Step 20: Not available.
Discovery Exercises
Discovery Exercise 1
Answers will vary. Some common commands include:
-
dume2fs –h /dev/hda1
-
mount (or cat /etc/mtab)
-
cat /etc/fstab
-
cat /etc/fstab
Discovery Exercise 2
-
2
-
2
-
2
-
3
-
3
-
3
-
8
-
8
-
8
All devices of the same general type share the same major number.
Discovery Exercise 3
Not Available.
Discovery Exercise 4
Answers will vary. Generally, you require more than one hard disk to reduce the likelihood that a had disk failure will greatly impact the system. The /var, /usr, /opt, /home, /boot, and / directories should be mounted to their own partition (preferably on separate hard disks). The /home directory should have quotas enabled that have a hard limit of 5Gb for all users.
Discovery Exercise 5
Answers will vary. Possible causes include:
a corrupted filesystem on /dev/hdc6
incorrect parameters in /etc/fstab
a corrupted hard disk
Some commands to diagnose the problem include:
fsck –f –t ext2 /dev/hdc6
fdisk /dev/hdc6
vi /etc/fstab
|