Get the App
SLTechnology News&Howtos  ›  Servers  › 

How do lvm partitions use xfs to reduce space?

Shulou Source: shulou.com Published: 2022-06-03 05:20:02 09月16日 Update

Ext4 file system, capacity expansion and reduction are relatively slow, I like to use the xfs file system.

But today I just know that the lvm of xfs cannot directly reduce the space online, so I must pay attention to the lvm partition of the xfs file system, which is as small as possible. Once online, it will only expand and not decrease!

If you forcibly use the previous lvm expansion method of the ext4 file system to reduce space, it will lead to a superblock error that cannot be mounted.

When it is a last resort to reduce the lvm partition space of the xfs file system, be sure to pay attention to the order.

Step zero, yum install-y xfsdump

The first step is to backup the target data. Take / home as an example.

Xfsdump-f "absolute path to dump file plus file name"directory that needs to be reduced"

such as

Xfsdump-f / opt/home.dump / home

Step two, uninstall the directory you mounted

Umount / home

Step three

Lvresize-L 7G / dev/mapper/centos-home

Whether to turn your original logical volume into 7G or to expand or shrink it will judge for itself.

Step 4 format to update to the latest size

Mkfs.xfs-f / dev/mapper/centos-home

Step 5: mount the empty partition

Mount / dev/mapper/centos-home

Finally, the data of dump is restored.

Xfsrestore-f / opt/home.dump / home

Tags: File system space capacity data directory last resort backup size I like data backup data recovery file name method time format for target path or Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Information vpn Shulou Tech Info OPPO Reno