Table of Contents
✅ Before You Begin: Important Notes
? 1. Extend a Logical Volume (Most Common Use Case)
Step 1: Check Available Space
Step 2: Extend the Logical Volume
Step 3: Resize the Filesystem
? 2. Shrink a Logical Volume (Advanced — Use Caution)
Step 1: Unmount the Filesystem
Step 2: Check and Resize the Filesystem First
Step 3: Shrink the Logical Volume
Step 4: Resize Again (Optional)
? 3. Check Final Layout
? Tips and Warnings
Home System Tutorial LINUX How to Resize a Linux LVM Partition

How to Resize a Linux LVM Partition

Aug 08, 2025 pm 01:35 PM
linux LVM分区

To safely adjust the size of Linux LVM partitions, you must first back up the data and ensure that the file system is not mounted (especially the root partition); 2. When expanding the logical volume, first use vgdisplay or vgs to check the free space of the volume group, then use the lvextend command to expand the LV, and finally use resize2fs (ext4) or xfs_growfs (XFS) to adjust the file system size; 3. The shrinking logical volume only supports ext series file systems. You must first uninstall the file system, run e2fsck check, use resize2fs to shrink the file system, and then use lvreduce to shrink the LV, and finally select resize2fs to expand the file system to match the LV and remount it; 4. After the operation is completed, use df -h, lvs, and vgs to verify the results; 5. The risk of increasing LV is low, and if you shrink, you need to be extra cautious and always operate in the correct order: when shrinking, the file system is first followed by LV, when expanding, the file system is first, and the entire process needs to ensure that there is enough space or add a new physical volume, and the normal access will be restored after the operation is completed.

How to Resize a Linux LVM Partition

Resizing a Linux LVM (Logical Volume Manager) partition is a common task when you need to expand or shrink storage space. Unlike traditional partitions, LVM offers flexibility, but the process requires careful steps to avoid data loss. Here's how to do it safely.

How to Resize a Linux LVM Partition

✅ Before You Begin: Important Notes

  • Backup your data — Always have a recent backup before resizing.
  • Boot from a live USB if you're resizing the root partition — you can't modify mounted filesystems.
  • Ensure you have free space in the volume group (VG) to grow a logical volume (LV), or enough space to shrink and move data.
  • This guide focuses on extending a logical volume. Shrinking is riskier and requires extra caution.

? 1. Extend a Logical Volume (Most Common Use Case)

This is useful when you've added a new disk or have unallocated space in your volume group.

Step 1: Check Available Space

 vgdisplay

Look for Free PE / Size — this shows how much space you can allocate.

How to Resize a Linux LVM Partition

Alternatively:

 vgs

Step 2: Extend the Logical Volume

Suppose you want to add 10GB to /dev/vg00/lv_root :

How to Resize a Linux LVM Partition
 lvextend -L 10G /dev/vg00/lv_root

Or to use all available free space:

 lvextend -l 100%FREE /dev/vg00/lv_root

Note: Use -L 10G to add 10GB, or -L 20G to set total size to 20GB.

Step 3: Resize the Filesystem

The LV is now larger, but the filesystem inside isn't. Resize it accordingly.

For ext4/ext3/ext2 :

 resize2fs /dev/vg00/lv_root

For XFS :

 xfs_growfs /mount/point

⚠️ xfs_growfs requires the filesystem to be mounted. resize2fs works on unmounted or mounted ext filesystems.


? 2. Shrink a Logical Volume (Advanced — Use Caution)

Only ext2/ext3/ext4 support shrinking safely. XFS cannot be shrunk .

Step 1: Unmount the Filesystem

 umount /mount/point

Step 2: Check and Resize the Filesystem First

For ext4:

 e2fsck -f /dev/vg00/lv_home
resize2fs /dev/vg00/lv_home 20G

This shrinks the filesystem to 20GB.

Step 3: Shrink the Logical Volume

 lvreduce -L 20G /dev/vg00/lv_home

You'll be prompted to confirm — double-check the size!

Step 4: Resize Again (Optional)

 resize2fs /dev/vg00/lv_home

This adjusts the filesystem to use the full LV size if needed.

Then remount:

 mount /dev/vg00/lv_home /home

? 3. Check Final Layout

Verify everything worked:

 df -h

And check LVM status:

 lvs
vgs
pvs

? Tips and Warnings

  • Never skip filesystem checks before shrinking.

  • Avoid shrinking root volumes unless absolutely necessary — use a live CD.

  • If you're low on space in the volume group, consider adding a new physical volume:

     pvcreate /dev/sdb1
    vgextend vg00 /dev/sdb1
  • LVM makes it easy to manage space across disks — use it to your advantage.


  • Basically, growing an LVM volume is safe and routine. Shrinking? Possible, but risky — back up first. The key is doing things in the right order: resize filesystem → then LV (when shrinking) , and LV → then filesystem (when growing) .

    Not hard once you know the steps — just don't rush it.

    The above is the detailed content of How to Resize a Linux LVM Partition. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to install software on Linux using the terminal? How to install software on Linux using the terminal? Aug 02, 2025 pm 12:58 PM

There are three main ways to install software on Linux: 1. Use a package manager, such as apt, dnf or pacman, and then execute the install command after updating the source, such as sudoaptininstallcurl; 2. For .deb or .rpm files, use dpkg or rpm commands to install, and repair dependencies when needed; 3. Use snap or flatpak to install applications across platforms, such as sudosnapinstall software name, which is suitable for users who are pursuing version updates. It is recommended to use the system's own package manager for better compatibility and performance.

The Ultimate Guide to High-Performance Gaming on Linux The Ultimate Guide to High-Performance Gaming on Linux Aug 03, 2025 am 05:51 AM

ChoosePop!_OS,Ubuntu,NobaraLinux,orArchLinuxforoptimalgamingperformancewithminimaloverhead.2.InstallofficialNVIDIAproprietarydriversforNVIDIAGPUs,ensureup-to-dateMesaandkernelversionsforAMDandIntelGPUs.3.EnabletheperformanceCPUgovernor,usealow-latenc

What are the main pros and cons of Linux vs. Windows? What are the main pros and cons of Linux vs. Windows? Aug 03, 2025 am 02:56 AM

Linux is suitable for old hardware, has high security and is customizable, but has weak software compatibility; Windows software is rich and easy to use, but has high resource utilization. 1. In terms of performance, Linux is lightweight and efficient, suitable for old devices; Windows has high hardware requirements. 2. In terms of software, Windows has wider compatibility, especially professional tools and games; Linux needs to use tools to run some software. 3. In terms of security, Linux permission management is stricter and updates are convenient; although Windows is protected, it is still vulnerable to attacks. 4. In terms of difficulty of use, the Linux learning curve is steep; Windows operation is intuitive. Choose according to requirements: choose Linux with performance and security, and choose Windows with compatibility and ease of use.

Understanding RAID Configurations on a Linux Server Understanding RAID Configurations on a Linux Server Aug 05, 2025 am 11:50 AM

RAIDimprovesstorageperformanceandreliabilityonLinuxserversthroughvariousconfigurations;RAID0offersspeedbutnoredundancy;RAID1providesmirroringforcriticaldatawith50�pacityloss;RAID5supportssingle-drivefailuretoleranceusingparityandrequiresatleastthre

Linux how to enable and disable services at boot Linux how to enable and disable services at boot Aug 08, 2025 am 10:23 AM

To manage the startup of Linux services, use the systemctl command. 1. Check the service status: systemctlstatus can check whether the service is running, enabled or disabled. 2. Enable the service startup: sudosystemctlenable, such as sudosystemctlenablenginx. If it is started at the same time, use sudosystemctlenable--nownginx. 3. Disable the service startup: sudosystemctldisable, such as sudosystemctldisablecups. If it is stopped at the same time, use sudosystemctldisabl

Linux how to list all running processes Linux how to list all running processes Aug 08, 2025 am 06:42 AM

Usepsauxforacompletesnapshotofallrunningprocesses,showingdetailedinformationlikeUSER,PID,CPU,andmemoryusage.2.Usetoporhtopforreal-timemonitoringofprocesseswithdynamicupdates,wherehtopoffersamoreintuitiveinterface.3.UsepgreporpidoftoquicklyfindthePIDs

How to clean up your Linux system How to clean up your Linux system Aug 22, 2025 am 07:42 AM

Removeunusedpackagesanddependencieswithsudoaptautoremove,cleanpackagecacheusingsudoaptcleanorautoclean,andremoveoldkernelsviasudoaptautoremove--purge.2.Clearsystemlogswithsudojournalctl--vacuum-time=7d,deletearchivedlogsin/var/log,andempty/tmpand/var

Linux how to view the contents of a file Linux how to view the contents of a file Aug 19, 2025 pm 06:44 PM

ToviewfilecontentsinLinux,usedifferentcommandsbasedonyourneeds:1.Forsmallfiles,usecattodisplaytheentirecontentatonce,withcat-ntoshowlinenumbers.2.Forlargefiles,uselesstoscrollpagebypageorlinebyline,searchwith/search_term,andquitwithq.3.Usemoreforbasi

See all articles