Skip to main content

Recover a corrupted filesystem

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

01:00:00

Difficulty

Advanced

In this exercise, you will repair and mount two corrupted file systems.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Recover a corrupted filesystem

Introduction

In this exercise, you will repair and mount two corrupted file systems.

A junior administrator has asked for your assistance in troubleshooting a couple of mounts in fstab. They are unable to mount the drives, but insist the mounts have worked in the past.

Solution

Start by logging in to the lab servers using the credentials provided on the hands-on lab page:

ssh cloud_user@PUBLIC_IP_ADDRESS

Become the root user:

sudo su -

Resolve the first mount in /etc/fstab

  1. View the contents of /etc/fstab:

    cat /etc/fstab
  2. Attempt to mount the first mount listed in /etc/fstab:

    mount /storage1
  3. Note that it is an XFS filesystem, and repair it:

    xfs_repair /dev/xvdb1
  4. Attempt to mount the filesystem again:

    mount /storage1
  5. Verify the files within /storage1 are available:

    ll /storage1

Resolve the second mount in /etc/fstab

  1. Attempt to mount the first mount listed in /etc/fstab:

    mount /storage2
  2. Note that it is an ext4 filesystem, and repair it:

    e2fsck -p /dev/xvdb2
  3. Attempt to mount the filesystem again:

    mount /storage2
  4. Verify the files within /storage1 are available:

    ll /storage2

Conclusion

Congratulations, you've completed this hands-on lab!