Bookmark this page

Lab: Configure and Manage File Systems and Storage

Note

If you plan to take the RHCSA exam, then use the following approach to maximize the benefit of this Comprehensive Review: attempt each lab without viewing the solution buttons or referring to the course content. Use the grading scripts to gauge your progress as you complete each lab.

Create a logical volume, mount a network file system, and create a swap partition that is automatically activated at boot. You also configure directories to store temporary files.

Outcomes

  • Create a logical volume.

  • Mount a network file system.

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

  • Configure a directory to store temporary files.

If you did not reset your workstation and server machines at the end of the last chapter, then save any work that you want to keep from earlier exercises on those machines, and reset them now.

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 rhcsa-compreview2

Specifications

  • On serverb, configure a new 1 GiB vol_home logical volume in a new 2 GiB extra_storage volume group. Use the unpartitioned /dev/vdb disk to create the partition.

  • Format the vol_home logical volume with the XFS file-system type, and persistently mount it on the /user-homes directory.

  • On serverb, persistently mount the /share network file system that servera exports on the /local-share directory. The servera machine exports the servera.lab.example.com:/share path.

  • On serverb, create a 512 MiB swap partition on the /dev/vdc disk. Persistently mount the swap partition.

  • Create the production user group. Create the production1, production2, production3, and production4 users with the production group as their supplementary group.

  • On serverb, configure the /run/volatile directory to store temporary files. If the files in this directory are not accessed for more than 30 seconds, then the system automatically deletes them. Set 0700 as the octal permissions for the directory. Use the /etc/tmpfiles.d/volatile.conf file to configure the time-based deletion of the files in the /run/volatile directory.

  1. On serverb, configure a new 1 GiB vol_home logical volume in a new 2 GiB extra_storage volume group. Use the unpartitioned /dev/vdb disk to create the partition.

    1. Log in to serverb 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. Create a 2 GiB partition on the /dev/vdb disk.

      [root@serverb ~]# parted /dev/vdb mklabel msdos
      ...output omitted...
      [root@serverb ~]# parted /dev/vdb mkpart primary 1MiB 2GiB
      ...output omitted...
      [root@serverb ~]# parted /dev/vdb set 1 lvm on
      ...output omitted...
    3. Declare the /dev/vdb1 block device as a physical volume.

      [root@serverb ~]# pvcreate /dev/vdb1
      ...output omitted...
    4. Create the extra_storage volume group with the /dev/vdb1 partition.

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

      [root@serverb ~]# lvcreate -L 1GiB -n vol_home extra_storage
      ...output omitted...
  2. Format the vol_home logical volume with the XFS file-system type, and persistently mount it on the /user-homes directory.

    1. Create the /user-homes directory.

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

      [root@serverb ~]# mkfs -t xfs /dev/extra_storage/vol_home
      ...output omitted...
    3. Persistently mount the /dev/extra_storage/vol_home partition on the /user-homes directory. Use the partition's UUID for the /etc/fstab file entry.

      [root@serverb ~]# lsblk -o UUID /dev/extra_storage/vol_home
      UUID
      988cf149-0667-4733-abca-f80c6ec50ab6
      [root@serverb ~]# echo "UUID=988c...0ab6 /user-homes xfs defaults 0 0" \
      >> /etc/fstab
      [root@serverb ~]# mount /user-homes
  3. On serverb, persistently mount the /share network file system that servera exports on the /local-share directory. The servera machine exports the servera.lab.example.com:/share path.

    1. Create the /local-share directory.

      [root@serverb ~]# mkdir /local-share
    2. Append the appropriate entry to the /etc/fstab file to persistently mount the servera.lab.example.com:/share network file system.

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

      [root@serverb ~]# mount /local-share
  4. On serverb, create a 512 MiB swap partition on the /dev/vdc disk. Activate and persistently mount the swap partition.

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

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

      [root@serverb ~]# mkswap /dev/vdc1
      ...output omitted...
    3. Create an entry in the /etc/fstab file to persistently mount the swap space. Use the partition's UUID to create the /etc/fstab file entry. Activate the swap space.

      [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
  5. Create the production user group. Then, create the production1, production2, production3, and production4 users with the production group as their supplementary group.

    [root@serverb ~]# groupadd production
    [root@serverb ~]# for i in 1 2 3 4; do useradd -G production production$i; done
  6. On serverb, configure the /run/volatile directory to store temporary files. If the files in this directory are not accessed for more than 30 seconds, then the system automatically deletes them. Set 0700 as the octal permissions for the directory. Use the /etc/tmpfiles.d/volatile.conf file to configure the time-based deletion of the files in the /run/volatile directory.

    1. Create the /etc/tmpfiles.d/volatile.conf file 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@serverb ~]# systemd-tmpfiles --create /etc/tmpfiles.d/volatile.conf
    3. Return to the workstation machine as the student user.

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

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 rhcsa-compreview2

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 rhcsa-compreview2

Revision: rh199-9.3-8dd73db