Home  >  Article  >  Operation and Maintenance  >  Centos7 adjusts LVM size of XFS format

Centos7 adjusts LVM size of XFS format

藏色散人
藏色散人forward
2020-07-21 16:52:542379browse

The following column centos Getting Started Tutorial will introduce to you how to adjust the LVM size of XFS format in centos7. I hope it will be helpful to friends in need!

Centos7 adjusts LVM size of XFS format

Premise: XFS is the pre-installed operating system of centos7. XFS can only be expanded but not reduced, so you need to use the xfsdump / xfsrestore tool to back up and Restore data.

The results of this experiment are:

1, /dev/mapper/centos-home only retains 500G;

2, allocate the space separated from /home to / dev/mapper/centos-root.

The original space size is as shown below:

Centos7 adjusts LVM size of XFS format

#step1: Install xfsdump package

yum -y install xfsdump

step2: 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

step3: Reduce the size of /dev/mapper/centos-home

Uninstall /home

# umount /home

Reduce the Logical Volume of /home to 5GB

# lvreduce -L 5G /dev/mapper/centos-homeDo you really want to reduce home? [y/n]: y

step4: Increase / Space size of dev/mapper/centos-root

# lvextend -l +100%FREE /dev/centos/root

Extend xfs space

# xfs_growfs /dev/centos/root

step5: Restore the contents of /home

Format the lvm of /home

# 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 as shown below:

Centos7 adjusts LVM size of XFS format

For more centos related technical articles, please visit the centos system tutorial column!

The above is the detailed content of Centos7 adjusts LVM size of XFS format. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete