Configure AutoFS to Automatically Mount Filesystems

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

`autofs` allows file systems to be automatically mounted when they are accessed. In this hands-on lab, you are tasked with configuring a series of mounts using `autofs`.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install the `autofs` Package and Start and Enable the `autofs` Service
  1. Use the yum command to install the autofs package:

    yum install -y autofs
  2. Start and enable the autofs service:

    systemctl enable autofs --now
Create an Indirect Mount at `/mnt/marketing`
  1. Create the /mnt/marketing directory:

    mkdir /mnt/marketing
  2. Use a text editor to add the following entry to /etc/auto.master for /mnt/marketing:

    /mnt/marketing /etc/auto.marketing
  3. Create a map file for /mnt/marketing called /etc/auto.marketing with the following contents:

    assets -fstype=xfs :/dev/xvdg1
    backup -fstype=btrfs,ro :/dev/xvdg2
  4. Restart the autofs service to apply the changes:

    systemctl restart autofs
Create a Direct Mount at `/mnt/admin/data`
  1. Use a text editor to add the following entry to /etc/auto.master:

    /- /etc/auto.admin
  2. Create a map file for the entry called /etc/auto.admin with the following contents:

    /mnt/admin/data -fstype=ext4 :/dev/xvdg3
  3. Restart the autofs service to apply the changes:

    systemctl restart autofs
Create a Direct Mount at `/mnt/user/data`
  1. Use a text editor to add the following entry to /etc/auto.master:

    /- /etc/auto.user --timeout=3600
  2. Create a map file for the entry called /etc/auto.user with the following contents:

    /mnt/user/data -fstype=ext2 :/dev/xvdg4
  3. Restart the autofs service to apply the changes:

    systemctl restart autofs

Additional Resources

You work as a system administrator in the IT department of your company. The marketing department has requested that you create two automounts for them. These should be indirect mounts that are mounted under /mnt/marketing. The first should be called assets, and it should have anxfs file system and use the /dev/xvdg1 device. The second should be called backup, and it should have a btrfs filesystem, be read-only, and use the /dev/xvdg2 device. The map file for this indirect map should be /etc/auto.marketing.

Next, you will need to create two direct mounts: one for administrators and the other for normal users. The administrator mount should be mounted at /mnt/admin/data with an ext4 file system using the /dev/xvdg3 device. The map file for this should be /etc/auto.admin. The user mount should be located at /mnt/user/data, have an ext2 file system, use the /dev/xvdg4 device, and have a timeout of one hour. The map file should be/etc/auto.user.

Note: All tasks should be performed as the root user.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!