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.
In this review, you 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.
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.
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 ~]#
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...
Declare the /dev/vdb1 block device as a physical volume.
[root@serverb ~]# pvcreate /dev/vdb1
...output omitted...Create the extra_storage volume group with the /dev/vdb1 partition.
[root@serverb ~]# vgcreate extra_storage /dev/vdb1
...output omitted...Create the 1 GiB vol_home logical volume.
[root@serverb ~]# lvcreate -L 1GiB -n vol_home extra_storage
...output omitted...Format the vol_home logical volume with the XFS file-system type, and persistently mount it on the /user-homes directory.
Create the /user-homes directory.
[root@serverb ~]# mkdir /user-homesFormat 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...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_homeUUID 988cf149-0667-4733-abca-f80c6ec50ab6 [root@serverb ~]#echo "UUID=[root@serverb ~]#988c...0ab6/user-homes xfs defaults 0 0" \ >> /etc/fstabmount /user-homes
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.
Create the /local-share directory.
[root@serverb ~]# mkdir /local-shareAppend 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
Mount the network file system on the /local-share directory.
[root@serverb ~]# mount /local-shareOn serverb, create a 512 MiB swap partition on the /dev/vdc disk.
Activate and persistently mount the swap partition.
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...
Create the swap space on the /dev/vdc1 partition.
[root@serverb ~]# mkswap /dev/vdc1
...output omitted...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/vdc1UUID cc18ccb6-bd29-48a5-8554-546bf3471b69 [root@serverb ~]#echo "UUID=[root@serverb ~]#cc18...1b69swap swap defaults 0 0" >> /etc/fstabswapon -a
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
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.
Create the /etc/tmpfiles.d/volatile.conf file with the following content:
d /run/volatile 0700 root root 30s
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.confReturn to the workstation machine as the student user.
[root@serverb ~]#exitlogout [student@serverb ~]$exitlogout Connection to serverb closed.
This concludes the section.