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

Centos7 adjusts LVM size of XFS format

藏色散人
Release: 2020-07-21 16:53:17
forward
2472 people have browsed it

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
Copy after login

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
Copy after login

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

Uninstall /home

# umount /home
Copy after login

Reduce the Logical Volume of /home to 5GB

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

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

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

Extend xfs space

# xfs_growfs /dev/centos/root
Copy after login

step5: Restore the contents of /home

Format the lvm of /home

# mkfs.xfs -f /dev/mapper/centos-home
Copy after login

Mount /home /dev/mapper/centos-home

# mount /home
Copy after login

Restore backup data to /home

# xfsrestore -f /home.xfsdump /home
Copy after login

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!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template