Home / Reduce the size of a non-root LVM and allocate that space to the root LVM?

Reduce the size of a non-root LVM and allocate that space to the root LVM?

Using the command df <MOUNTPOINT>, find the path to the LVM logical volume device node file (LV_PATH) for the specific filesystem mount point, for instance.

df /home
  • Unmount the filesystem (necessitates stopping all access to the filesystem, e.g., for /home, all users will need to log out)
  • Fsck the filesystem
  • Shrink the filesystem
  • Shrink the LVM logical volume

The above steps can be performed using lvresize –resizefs –size <SIZE> <LV_PATH>, for example:

lvresize --resizefs --size 20G /dev/VolGroup00/LogVol02 # Absolute size of 20 GiB
lvresize --resizefs --size -260M /dev/VolGroup00/LogVol02 # 260 MiB less than current

The <SIZE> specified is handled as an absolute value unless a minus or plus sign is used to denote a relative number; otherwise, the <SIZE> specified is treated as a relative number.

Use the same command to increase the root LVM logical volume after the first logical volume has been shrunk down, for instance.

lvresize --resizefs --size 80G /dev/VolGroup00/LogVol00 # Absolute size of 80 GiB
lvresize --resizefs --size +972M /dev/VolGroup00/LogVol00 # 972 MiB more than current

Verify the final sizes of filesystem / and /home by using df <MOUNTPOINT>

Leave a Reply