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

  1. 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?

  2. 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?

  3. Name the directories that must be within the root partition.

  4. Describe the differences between physical disks, partitions, and filesystems.

  5. What is a /swap partition used for? Why not just use swap files?

  6. What kind of output will df -h yield?

  7. Describe a common situation that is likely to cause the automatic use of fsck on the next system boot.

  8. Name the fields in /etc/fstab.

  9. 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.

  10. If the ro option is used in /etc/fstab for /usr, what limitation is placed on that filesystem?

  11. Compare and contrast hard and soft quota limits.

  12. What three types of users can be granted or denied access to filesystem objects and how do they apply to files and directories?

  13. Name the symbolic permission that is equivalent to 0754.

  14. Describe a situation that requires the SUID permission. What ramifications does this permission imply?

  15. Compare and contrast the differences between hard and symbolic links.

  16. Name the document to which Linux directory assignments should conform.

  17. 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.

8.2.2.1 Exercise 2.4-1. Partitions and filesystems
  1. 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.

  2. 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
  1. Use a pager to examine /var/log/messages and search for entries made by fsck. Did it find any problems?

  2. 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
    1. How does the -h flag assist you with interpreting the results?

    2. Are any of your filesystems nearly full?

    3. Which are underutilized?

  4. As root, get a top-level view of disk usage by user using du:

    $ du -s /home/*
    1. Are there any surprises?

    2. How could you use sort to make this output more useful?

8.2.2.3 Exercise 2.4-3. Mounting and unmounting
  1. Review /etc/fstab. Be sure you can name all six fields and their order as well as describe their function.

  2. Examine the output of the mount command without options. Compare the output with the contents of /etc/fstab.

  3. 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
    1. Did the filesystem mount correctly? Can you store files on it?

    2. 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
8.2.2.4 Exercise 2.4-4. Disk quotas
  1. Using the instructions in Section 4.4, enable quotas on your /home filesystem.

  2. 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
  1. Practice converting these file modes from octal to symbolic form:

    1. 0777

    2. 0754

    3. 0666

    4. 1700

    5. 7777

  2. Practice converting these file modes from symbolic to octal form. You can assume that x bits are set under SUID, SGID, and sticky bits:

    1. -rwxr-xr-x

    2. -r--r--r--

    3. -rwsrwsrwx

    4. -rw-rw---t

    5. -rws-w--w-

  3. Create temporary files and use chmod with both symbolic and numeric mode modifications. Include SUID, SGID, and sticky bits.

  4. 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
  1. As root, create temporary files and use chown to modify user ownership and group ownership.

  2. Use chgrp to modify group ownership on the temporary files created in the previous exercise.

8.2.2.7 Exercise 2.4-7. Links
  1. 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
8.2.2.8 Exercise 2.4-8. File location
  1. Read the latest version of the FHS (it's not very long).

  2. Examine your filesystem. Does it match the FHS? If you find discrepancies, is it clear why they don't?

  3. Use which to check on the location of executable files.

  4. 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.

  5. Update your locate database using updatedb. Note the amount of time this command takes and the resources it consumes on your system.