Recover mis-configured or broken LVM configurations

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 need to assess the cause of a broken LVM configuration and resolve it without losing the data in the volume.

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 mis-configured or broken LVM configurations

Introduction

In this exercise, you will need to assess the cause of a broken LVM configuration and resolve it without losing the data in the volume.

A business unit requested an increase to the volume mounted at /lvm_mount and ever since has been complaining that the volume is unavailable. The administrator that made the change is no longer available and you must troubleshoot and resolve the issue.

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 LVM configuration

  1. View the contents of /etc/fstab:

    cat /etc/fstab
  2. Attempt to mount the volume:

    mount /lvm_mount
  3. View the archive metadata:

    vgcfgrestore -l <VOLGROUP NAME>
  4. Review the changes:

    > "Created before executing 'lvresize -L500M /dev/vg_1/lv_1'"

  5. Restore prior to latest change:

    vgcfgrestore -f /etc/lvm/archive/NAME_OF_FILE vg_1
  6. Deactivate and reactive the volume:

    lvchange -an /dev/<VOLGROUP>/<LOG>
    lvchange -ay /dev/<VOLGROUP>/<LOG>
  7. Mount the volume:

    mount /lvm_mount/
  8. Display any files that are in this volume:

    ll /lvm_mount/

Verify LVM volume contents

  1. The MD5s of each file in the volume are available in the /home/cloud_user/lvm_md5s.txt.txt file. Validate that the md5sums haven't changed for the files in the /lvm_mount directory.

    cat /home/cloud_user/lvm_md5s.txt.txt
    for i in $(ls /lvm_mount/); do md5sum /lvm_mount/$i; done

Conclusion

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