• Webconn Technology
    • GPU Server
      • Dedicated GPU Servers with NVIDIA RTX/A100 GPUs for accelerated AI training, rendering, and scientific computing. Features CUDA cores, 24GB-141GB VRAM, and parallel processing. Pre-configured with TensorFlow/PyTorch.

      • nvidia rtx A6000
    • Dedicated Server
      • Experience blazing-fast speeds & ironclad security with your own dedicated server. No shared resources. Fully customizable plans for gaming, e-commerce, and big data. Start now!

      • datacenter
    • Shared Hosting
      • Get user-friendly DirectAdmin shared hosting for your website. Enjoy an intuitive control panel, one-click app installs, and reliable performance. Perfect for blogs, small business sites, and portfolios.

      • shared hosting web
    • Domains
      • Search and register the perfect domain name for your website. Get a memorable .com, .net, .org or niche TLD to start building your brand online. Includes free privacy protection.

    • VPS
      • Experience the power of a dedicated server without the high cost. Our VPS hosting guarantees CPU, RAM, and storage for your site, ensuring optimal performance and stability.

      • data center
  • Blog
  • Dashboard

How to shrink an LVM Logical Volume

Category:

Overview

Since shrinking is not supported on these file systems, you cannot reduce the size of a logical volume that houses a GFS2 or XFS file system.

lvreduce

The lvreduce command typically warns about potential data loss and requests confirmation. In some circumstances, such as when the logical volume is inactive, or the —resizefs option is not used, you may not see these confirmation prompts, so you shouldn’t rely on them to prevent data loss. It should be noted that the —test option of the lvreduce command does not examine the file system or test the filesystem; thus, using it does not show whether the operation is safe.

Use the following command to find the name of the logical volume that you want to shrink.

# lvs




The disk must be unmounted to do a lvreduce. Hence this must be done while the disk is idle. To ensure data integrity, perform a filesystem check after that.

# umount /dev/vg0/lv_data
# e2fsck -f /dev/vg0/lv_data

CentOS 5 only: Resize the existing filesystem to 80Gb (ie: 100Gb – 20Gb = 80Gb).

# resize2fs /dev/vg0/lv_data 80G

Centos 6, 7 only: Resize the logical volume.

# lvreduce -r -L 80G /dev/vg0/lv_data

On CentOS 5, use lvreduce as follows.

# lvreduce -L 80G /dev/vg0/lv_data

Mount LV

Mount the LV logical volume as follows.

# mount /dev/vg0/lv_data

There is currently 20G of free space in the volume group. The 20G free space can then be used to build a new logical volume using lvcreate.

Leave a Reply