Bookmark this page

Guided Exercise: Mount and Unmount File Systems

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

  1. 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 ~]#
  2. 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.

    1. Create the /mnt/part1 directory.

      [root@servera ~]# mkdir /mnt/part1
    2. Query the UUID of the /dev/vdb1 device.

      [root@servera ~]# lsblk -fp /dev/vdb
      NAME        FSTYPE LABEL UUID                                 MOUNTPOINT
      /dev/vdb
      └─/dev/vdb1 xfs          a04c511a-b805-4ec2-981f-42d190fc9a65
    3. 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
    4. Verify that the /dev/vdb1 device is mounted on the /mnt/part1 directory.

      [root@servera ~]# lsblk -fp /dev/vdb
      NAME        FSTYPE LABEL UUID                                 MOUNTPOINT
      /dev/vdb
      └─/dev/vdb1 xfs          a04c511a-b805-4ec2-981f-42d190fc9a65 /mnt/part1
  3. Change to the /mnt/part1 directory and create the testdir subdirectory. Create the /mnt/part1/testdir/newmount file.

    1. Change to the /mnt/part1 directory.

      [root@servera ~]# cd /mnt/part1
    2. Create the /mnt/part1/testdir directory.

      [root@servera part1]# mkdir testdir
    3. Create the /mnt/part1/testdir/newmount file.

      [root@servera part1]# touch testdir/newmount
  4. Unmount the file system that is mounted on the /mnt/part1 directory.

    1. 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.
    2. Change the current directory on the shell to the /root directory.

      [root@servera part1]# cd
      [root@servera ~]#
    3. Unmount the /mnt/part1 directory.

      [root@servera ~]# umount /mnt/part1
  5. Return to the workstation machine as the student user.

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

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-mount

This concludes the section.

Revision: rh124-9.0-398f302