Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Lab 15.2RHCSA 10, Chapter 15

Grow and shrink logical volumes

Level
Medium
30 min
Machines
server1
Status
Not started

Goal

Add a disk to a full volume group, grow an XFS and an ext4 volume while they are in use, shrink the ext4 volume, and take one disk out of the VG.

Before you start

  • Finish lab 15.1. Add a second empty disk of 5 GiB (here /dev/vdd). Work as root.

Tasks

  1. Add the whole disk /dev/vdd to the volume group vgfiles.
  2. Grow lvfiles by 1 GiB while it stays mounted. df -h /files must show the new size.
  3. Grow lvdocs to a total size of 5 GiB, also while mounted.
  4. Shrink lvdocs to 3 GiB without losing its files.
  5. Move all data away from /dev/vdd and remove the disk from the VG (if the VG has enough free space; if not, shrink first or skip this task and explain why).

Check your work

vgs vgfiles; pvs
lvs vgfiles
df -h /files /docs
  • /files is 1 GiB bigger than before.
  • /docs is 3 GiB at the end, and your test files are still there.
  • After task 5, pvs shows /dev/vdd without a VG (or not as a PV).

Hints

Show the hints

Solution

Show the solution
  1. Extend the VG.
    pvcreate /dev/vdd
    vgextend vgfiles /dev/vdd
  2. Grow lvfiles with its XFS.
    lvextend -r -L +1G /dev/vgfiles/lvfiles
    df -h /files
  3. Grow lvdocs to 5 GiB.
    lvextend -r -L 5G /dev/vgfiles/lvdocs
  4. Shrink lvdocs (ext4) to 3 GiB.
    cp -a /etc/hosts /docs/test.txt
    lvreduce -r -L 3G /dev/vgfiles/lvdocs
    cat /docs/test.txt
  5. Free /dev/vdd.
    pvmove /dev/vdd
    vgreduce vgfiles /dev/vdd
    pvremove /dev/vdd

My notes

No notes yet.

Lessons for this lab

Commands in this lab