Centos7: how to adjust the LVM size in XFS format and centos7 to adjust xfslvm

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.