In this exercise, you practice mounting and unmounting file systems.
Outcomes
Identify and mount a new file system at a specified mount point, and then unmount the 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-mount
Instructions
Log in to the servera machine as the student user and switch to the root user.
[student@workstation ~]$ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
A new partition with a file system is added to the /dev/vdb disk on the servera machine.
Mount the newly available partition by using the UUID at the /mnt/part1 mount point.
Create the /mnt/part1 directory.
[root@servera ~]# mkdir /mnt/part1Query the UUID of the /dev/vdb1 device.
[root@servera ~]#lsblk -fp /dev/vdbNAME FSTYPE LABEL UUID MOUNTPOINT /dev/vdb └─/dev/vdb1 xfsa04c511a-b805-4ec2-981f-42d190fc9a65
Mount the file system by using the UUID on the /mnt/part1 directory.
Use the /dev/vdb1 UUID from the previous command output.
[root@servera ~]#mount \UUID="a04c511a-b805-4ec2-981f-42d190fc9a65" /mnt/part1
Verify that the /dev/vdb1 device is mounted on the /mnt/part1 directory.
[root@servera ~]#lsblk -fp /dev/vdbNAME FSTYPE LABEL UUID MOUNTPOINT /dev/vdb └─/dev/vdb1 xfs a04c511a-b805-4ec2-981f-42d190fc9a65/mnt/part1
Change to the /mnt/part1 directory and create the testdir subdirectory.
Create the /mnt/part1/testdir/newmount file.
Change to the /mnt/part1 directory.
[root@servera ~]# cd /mnt/part1Create the /mnt/part1/testdir directory.
[root@servera part1]# mkdir testdirCreate the /mnt/part1/testdir/newmount file.
[root@servera part1]# touch testdir/newmountUnmount the file system that is mounted on the /mnt/part1 directory.
Unmount the /mnt/part1 directory when the shell is in the /mnt/part1 directory.
The umount command fails to unmount the device.
[root@servera part1]# umount /mnt/part1
umount: /mnt/part1: target is busy.Change the current directory on the shell to the /root directory.
[root@servera part1]# cd
[root@servera ~]#Unmount the /mnt/part1 directory.
[root@servera ~]# umount /mnt/part1Return to the workstation machine as the student user.
[root@servera ~]#exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation]$
This concludes the section.