Book: LPI Linux Certification in a Nutshell Section: Chapter 8. Exam 101 Review Questions and Exercises
### 8.2 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4) #### 8.2.1 Review questions How many IDE devices can be installed in a Linux system? If all of them are installed and they're all disk drives, what are their device names? What are the three types of disk partitions found on a Linux system? Which type can contain other partitions and which type does it contain? Name the directories that must be within the root partition. Describe the differences between physical disks, partitions, and filesystems. What is a /swap partition used for? Why not just use swap files? What kind of output will df -h yield? Describe a common situation that is likely to cause the automatic use of fsck on the next system boot. Name the fields in /etc/fstab. Give the command to mount a CD-ROM drive on the secondary master IDE device, assuming that /etc/fstab does not contain a line for the device. If the ro option is used in /etc/fstab for /usr, what limitation is placed on that filesystem? Compare and contrast hard and soft quota limits. What three types of users can be granted or denied access to filesystem objects and how do they apply to files and directories? Name the symbolic permission that is equivalent to 0754. Describe a situation that requires the SUID permission. What ramifications does this permission imply? Compare and contrast the differences between hard and symbolic links. Name the document to which Linux directory assignments should conform. Compare and contrast the differences between the locate and find commands. #### 8.2.2 Exercises
| Working with partitions and filesystems can damage your system. It is recommended that you use an expendable Linux system to perform the following exercises to be certain that mistakes won't harm a production system.
2. ##### 8.2.2.1 Exercise 2.4-1. Partitions and filesystems As root, run fdisk and enter the p command to print the partition table. Examine your system's configuration and make sure you understand everything you see. Enter the l (a lowercase L) command and review the many partition types Linux can accommodate. Enter the q command to quit without saving changes. If you have available disk space, use fdisk to create a new ext2 partition, then format it with mkfs. Pay close attention to the output from mkfs. ##### 8.2.2.2 Exercise 2.4-2, Filesystem integrity Use a pager to examine /var/log/messages and search for entries made by fsck. Did it find any problems? If you created a new partition in Exercises 2.4-1 and 2.4-2, check it now with fsck and observe the output:
       $ fsck -f /dev/partition
3. Check on the status of filesystems using df:
       $ df -h
4. How does the -h flag assist you with interpreting the results? Are any of your filesystems nearly full? Which are underutilized? As root, get a top-level view of disk usage by user using du:
       $ du -s /home/*
3. Are there any surprises? How could you use sort to make this output more useful? ##### 8.2.2.3 Exercise 2.4-3. Mounting and unmounting Review /etc/fstab. Be sure you can name all six fields and their order as well as describe their function. Examine the output of the mount command without options. Compare the output with the contents of /etc/fstab. If you created a new partition in Exercises 2.4-1 and 2.4-2, mount it on /mnt/new or some other location of your choosing:
       $ mkdir /mnt/new
       $ mount /dev/partition /mnt/new
       $ df /mnt/new
   2. Did the filesystem mount correctly? Can you store files on it? Next, unmount it:
          $ umount /dev/partition /mnt/new
   3. Add a line to /etc/fstab for the new partition:
          /dev/partition  /mnt/new   ext2   defaults   1 2
1. ##### 8.2.2.4 Exercise 2.4-4. Disk quotas Using the instructions in Section 4.4, enable quotas on your /home filesystem. Test the quotas by setting them low for a particular user, then start adding files as that user until the quota is exceeded. What is the observable consequence of exceeding the quota? ##### 8.2.2.5 Exercise 2.4-5. File permissions Practice converting these file modes from octal to symbolic form: 0777 0754 0666 1700 7777 Practice converting these file modes from symbolic to octal form. You can assume that `x` bits are set under SUID, SGID, and sticky bits: `-rwxr-xr-x` `-r--r--r--` `-rwsrwsrwx` `-rw-rw---t` `-rws-w--w-` Create temporary files and use chmod with both symbolic and numeric mode modifications. Include SUID, SGID, and sticky bits. Using the instructions in Section 4.5 to set up a workgroup directory using group and sticky bits for access control. Verify that the directory meets the defined requirements. ##### 8.2.2.6 Exercise 2.4-6. File ownership As root, create temporary files and use chown to modify user ownership and group ownership. Use chgrp to modify group ownership on the temporary files created in the previous exercise. ##### 8.2.2.7 Exercise 2.4-7. Links Create a temporary file and links as follows:
       $ touch a_file
       $ ln -s a_file an_slink
       $ ln a_file an_hlink
2. Now verify that the file and the hard link indeed share an inode and that the symbolic link points to the original file:
       $ ls -a_file an_slink an_hlink
4. ##### 8.2.2.8 Exercise 2.4-8. File location Read the latest version of the FHS (it's not very long). Examine your filesystem. Does it match the FHS? If you find discrepancies, is it clear why they don't? Use which to check on the location of executable files. Use find to search for bash:
       $ find / -name bash
   Now use locate for the same file:
       $ locate bash
How are the results different? Describe a context in which each command would be useful. Update your locate database using updatedb. Note the amount of time this command takes and the resources it consumes on your system.