Bookmark this page

Lab: Configuring and Managing File Systems and Storage

In this review, you will create an LVM logical volume, mount a network file system, create a swap partition that is automatically activated at boot, configure temporary unused files to be cleaned from the system, and use ACLs to protect a directory.

Outcomes

You should be able to:

  • Create an LVM logical volume.

  • Mount a network file system.

  • Create a swap partition that is automatically activated at boot.

  • Configure temporary unused files to be cleaned from the system.

  • Use ACLs to protect a directory.

Copy any files or work you wish to keep to other systems before resetting. Reset the workstation, servera, and serverb systems now, unless you just finished resetting them at the end of the last exercise.

Log in to workstation as student using student as the password.

On workstation, run lab rhcsa-compreview2 start to start the comprehensive review. This script creates the necessary files to set up the environment correctly.

[student@workstation ~]$ lab rhcsa-compreview2 start

Instructions

Perform the following tasks on serverb to complete the comprehensive review.

  • Configure a new 1 GiB logical volume called vol_home in a new 2 GiB volume group called extra_storage. Use the unpartitioned /dev/vdb disk to create partitions.

  • The logical volume vol_home should be formatted with the XFS file-system type, and mounted persistently on /home-directories.

  • Ensure that the network file system called /share is persistently mounted on /local-share across reboot. The NFS server servera.lab.example.com exports the /share network file system. The NFS export path is servera.lab.example.com:/share.

  • Create a new 512 MiB partition on the /dev/vdc disk to be used as swap space. This swap space must be automatically activated at boot.

  • Create a new group called production. Create the production1, production2, production3, and production4 users. Ensure that they use the new group called production as their supplementary group.

  • Configure your system so that it uses a new directory called /run/volatile to store temporary files. Files in this directory should be subject to time based cleanup if they are not accessed for more than 30 seconds. The octal permissions for the directory must be 0700. Make sure that you use the /etc/tmpfiles.d/volatile.conf file to configure the time based cleanup for the files in /run/volatile.

  • Create the new directory called /webcontent. Both the owner and group of the directory should be root. The group members of production should be able to read and write to this directory. The production1 user should only be able to read this directory. These permissions should apply to all new files and directories created under the /webcontent directory.

  1. From workstation, open an SSH session to serverb as student.

    1. [student@workstation ~]$ ssh student@serverb
      ...output omitted...
  2. Switch to the root user.

    1. [student@serverb ~]$ sudo -i
      [sudo] password for student: student
      [root@serverb ~]# 
  3. Create a 2 GiB partition on /dev/vdb.

    1. [root@serverb ~]# parted /dev/vdb mklabel msdos
      [root@serverb ~]# parted /dev/vdb mkpart primary 1GiB 3GiB
      [root@serverb ~]# parted /dev/vdb set 1 lvm on
  4. Create a logical volume called vol_home using the 2 GiB partition you created on /dev/vdb. Name the volume group extra_storage.

    1. Declare the /dev/vdb1 block device as a physical volume.

      [root@serverb ~]# pvcreate /dev/vdb1
      ...output omitted...
    2. Create the extra_storage volume group using /dev/vdb1.

      [root@serverb ~]# vgcreate extra_storage /dev/vdb1
      ...output omitted...
    3. Create a 1 GiB logical volume named vol_home.

      [root@serverb ~]# lvcreate -L 1GiB -n vol_home extra_storage
      ...output omitted...
  5. Format vol_home with the XFS file-system type, and mount it on /home-directories.

    1. Create a directory called /home-directories.

      [root@serverb ~]# mkdir /home-directories
    2. Format /dev/extra_storage/vol_home with the XFS file-system type.

      [root@serverb ~]# mkfs -t xfs /dev/extra_storage/vol_home
      ...output omitted...
    3. Persistently mount /dev/extra_storage/vol_home on /home-directories. Use the structure's UUID when creating the entry in /etc/fstab.

      [root@serverb ~]# lsblk -o UUID /dev/extra_storage/vol_home
      UUID
      988cf149-0667-4733-abca-f80c6ec50ab6
      [root@serverb ~]# echo "UUID=988c...0ab6 /home-directories \
      xfs defaults 0 0" >> /etc/fstab
      [root@serverb ~]# mount -a
  6. Ensure that the network file system called /share is persistently mounted on /local-share across reboot. The NFS server servera.lab.example.com exports the /share network file system. The NFS export path is servera.lab.example.com:/share.

    1. Create the /local-share directory.

      [root@serverb ~]# mkdir /local-share
    2. Append the appropriate entry to /etc/fstab so that the network file system available at servera.lab.example.com:/share is persistently mounted on /local-share across reboot.

      [root@serverb ~]# echo "servera.lab.example.com:/share /local-share \
      nfs rw,sync 0 0" >> /etc/fstab
    3. Mount the network file system on /local-share based on the entry in /etc/fstab.

      [root@serverb ~]# mount /local-share
  7. Create a new 512 MiB partition on the /dev/vdc disk to be used as swap space. This swap space must be automatically activated at boot time.

    1. Create a 512 MiB partition on /dev/vdc.

      [root@serverb ~]# parted /dev/vdc mklabel msdos
      [root@serverb ~]# parted /dev/vdc mkpart primary linux-swap 1MiB 513MiB
    2. Make the swap space on /dev/vdc1.

      [root@serverb ~]# mkswap /dev/vdc1
      ...output omitted...
    3. Activate the swap space so that it persists across reboot. Use the structure's UUID when creating the entry in /etc/fstab.

      [root@serverb ~]# lsblk -o UUID /dev/vdc1
      UUID
      cc18ccb6-bd29-48a5-8554-546bf3471b69
      [root@serverb ~]# echo "UUID=cc18...1b69 swap \
      swap defaults 0 0" >> /etc/fstab
      [root@serverb ~]# swapon -a
  8. Create the production1, production2, production3, and production4 users. Ensure that they use the new group called production as their supplementary group.

    1. [root@serverb ~]# groupadd production
      [root@serverb ~]# for i in 1 2 3 4; do useradd -G production production$i; done
  9. Configure your system so that it uses a new directory called /run/volatile to store temporary files. Files in this directory should be subject to time based cleanup if they are not accessed for more than 30 seconds. The octal permissions for the directory must be 0700. Make sure that you use the /etc/tmpfiles.d/volatile.conf file to configure the time based cleanup for the files in /run/volatile.

    1. Create a file called /etc/tmpfiles.d/volatile.conf with the following content.

      d /run/volatile 0700 root root 30s
    2. Use the systemd-tmpfiles --create command to create the /run/volatile directory if it does not exist.

      [root@servera ~]# systemd-tmpfiles --create /etc/tmpfiles.d/volatile.conf
  10. Create a new directory called /webcontent. Both the owner and group owner of the directory should be root. The group members of production should be able to read and write to this directory. The production1 user should only be able to read this directory. These permissions should apply to all new files and directories created under the /webcontent directory.

    1. Create the /webcontent directory.

      [root@serverb ~]# mkdir /webcontent
    2. Use setfacl to configure permissions on /webcontent so that the group members of production have both read and write permissions to it, with the exception of the production1 user, who should only be granted read permission.

      [root@serverb ~]# setfacl -m u:production1:rx /webcontent
      [root@serverb ~]# setfacl -m g:production:rwx /webcontent
    3. Use setfacl to set the default permissions on /webcontent so that the permissions you applied in the preceding step also apply to all new files and directories created under the /webcontent directory.

      [root@serverb ~]# setfacl -m d:u:production1:rx /webcontent
      [root@serverb ~]# setfacl -m d:g:production:rwx /webcontent
    4. Exit the root user's shell.

      [root@serverb ~]# exit
      logout
    5. Log off from serverb.

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

Evaluation

On workstation, run the lab rhcsa-compreview2 grade script to confirm success on this exercise. Correct any reported failures and rerun the script until successful.

[student@workstation ~]$ lab rhcsa-compreview2 grade

Finish

On workstation, run lab rhcsa-compreview2 finish to complete this exercise. This script deletes the files and resources created throughout the exercise and ensures that the environment is clean.

[student@workstation ~]$ lab rhcsa-compreview2 finish

This concludes the comprehensive review.

Revision: rh134-8.2-f0a9756