Centos7: how to adjust the LVM size in XFS format and centos7 to adjust xfslvm
Prerequisites: XFS is a pre-installed centos7 operating system. XFS can only be expanded but cannot be reduced. Therefore, xfsdump/xfsrestore must be used to back up and restore data when lvm must be reduced.
The results of this experiment are as follows:
1,/dev/mapper/centos-home only 500 GB;
2. Allocate the space allocated by/home to/dev/mapper/centos-root.
Shows the size of the original space:
Step 1: Security xfsdump suite
yum -y install xfsdump
Step 2: Back up/home
xfsdump -f /home.xfsdump /homeplease enter label for this dump session (timeout in 300 sec)-> homeplease enter label for media in drive 0 (timeout in 300 sec)-> home
Step 3: reduce the size of/dev/mapper/centos-home
Unload logs/home
# umount /home
Set/home's Logical Volume to 5 GB
# lvreduce -L 5G /dev/mapper/centos-homeDo you really want to reduce home? [y/n]: y
Step 4: Increase the space of/dev/mapper/centos-root
# lvextend -l +100%FREE /dev/centos/root
Extend xfs Space
# xfs_growfs /dev/centos/root
Step 5: Restore/home content
Format/home lvm
# mkfs.xfs -f /dev/mapper/centos-home
Mount/home/dev/mapper/centos-home
# mount /home
Restore backup data to/home
# xfsrestore -f /home.xfsdump /home
The adjusted space size is shown in the following figure: