## We want to shrink /dev/rhel/home currently using 141g and mounted on /home
## (1). Take backup of the filesystem using xfsdump
[root@rhel7sat1 ~]# xfsdump -f /var/tmp/home-xfs.dump /home xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
[root@rhel7sat1 ~]# lvreduce -L 9G /dev/rhel/home WARNING: Reducing active logical volume to 9.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce rhel/home? [y/n]: y
Size of logical volume rhel/home changed from 10.00 GiB (2560 extents) to 9.00 GiB (2304 extents).
Logical volume rhel/home successfully resized
[root@rhel7sat1 ~]# df -h /home Filesystem Size Used Avail Use% Mounted on /dev/mapper/rhel-home 9.0G 33M 9.0G 1% /home
## (6) restore from dump
[root@rhel7sat1 ~]# xfsrestore -f /var/tmp/home-xfs.dmp /home xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description:
xfsrestore: hostname: rhel7sat1
xfsrestore: mount point: /home
xfsrestore: volume: /dev/mapper/rhel-home
xfsrestore: session time: Wed Jul 22 11:13:15 2020
xfsrestore: level: 0
xfsrestore: session label: "home"
xfsrestore: media label: "home"
xfsrestore: file system id: 82825a22-5e1e-4ea6-bde9-38077a069767
xfsrestore: session id: 9ab9dda5-52a9-446b-9380-f60cafdd5c21
xfsrestore: media id: 797cce91-d6c8-4d03-94b0-edd03bda3b90
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 5 directories and 7 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore: stream 0 /var/tmp/home-xfs.dmp OK (success)
xfsrestore: Restore Status: SUCCESS
Grow
## Scenario 1 : Add another partition
## Firstly follow his guide to extend the disk
## assuming the Volume group (vg) is rhel and the Logical volume is var
## Create the partition e.g. for GPT formatted disk, using gdisk, for MBR formatted disk, using fdisk
gdisk /dev/sda
Command (? for help): n Partition number (4-128, default 4): Enter
First sector .... : Enter
Last sector ..... : Enter
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): Enter Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
## do a partprobe to rescan the disk and detect the new partition