Bookmark this page

Lab: Access Linux File Systems

Mount a local file system and locate specific files on that file system.

Outcomes

  • Mount a file system.

  • Generate a disk usage report.

  • Find files in the local file system.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start fs-review

Instructions

  1. On the serverb machine as the root user, identify the UUID for the /dev/vdb1 device, and mount it by using its UUID on the /mnt/freespace directory.

    1. Log in to the serverb machine as the student user, and switch to the root user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]#
    2. Query the UUID of the /dev/vdb1 device.

      [root@serverb ~]# lsblk -fp /dev/vdb
      NAME        FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
      /dev/vdb
      └─/dev/vdb1 xfs                44bfb7c8-970c-4d0b-b53d-90ae31cb27ca
    3. Create the /mnt/freespace directory.

      [root@serverb ~]# mkdir /mnt/freespace
    4. Mount the /dev/vdb1 device by using the UUID on the /mnt/freespace directory.

      [root@serverb ~]# mount UUID="44bfb7c8-970c-4d0b-b53d-90ae31cb27ca" /mnt/freespace
    5. Verify that the /dev/vdb1 device is mounted on the /mnt/freespace directory.

      [root@serverb ~]# lsblk -fp /dev/vdb1
      NAME     FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
      /dev/vdb1
               xfs                44bfb7c8-970c-4d0b-b53d-90ae31cb27ca    4.9G     1% /mnt/freespace
  2. Generate a disk usage report for the /usr/share directory. Save the result in the /mnt/freespace/results.txt file.

    [root@serverb ~]# du /usr/share > /mnt/freespace/results.txt
  3. Locate all the files that match the rsyslog.conf keyword, and store the result in the /mnt/freespace/search1.txt file.

    1. Update the locate database.

      [root@serverb ~]# updatedb
    2. Use the locate command to find all the files that match the rsyslog.conf keyword, and save the result in the /mnt/freespace/search1.txt file.

      [root@serverb ~]# locate rsyslog.conf > /mnt/freespace/search1.txt
  4. Store in the /mnt/freespace/search2.txt file the search result of all files in the /usr/share directory that are greater than 50 MB and less than 100 MB.

    [root@serverb ~]# find /usr/share -size +50M -size -100M > \
    /mnt/freespace/search2.txt
  5. Return to the workstation system as the student user.

    [root@serverb ~]$ exit
    logout
    [student@serverb ~]$ exit
    logout
    Connection to serverb closed.
    [student@workstation ~]$

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade fs-review

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish fs-review

Revision: rh124-9.3-770cc61