• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Unable To Extend LVM File System with Associated Snapshot in CentOS/RHEL

by admin

The Problem

User is unable to Extend LVM file system which has snapshot, Error “Snapshot origin volumes can be resized only while inactive: try lvchange -an“. The user has created a snapshot on non-root LVM volume as shown below.

# lvcreate --size 100M --snapshot --name testsnap /dev/testVG/testLV 
  Logical volume "testsnap" created
# lvs -a -o+devices
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices       
  LogVol00 VolGroup00 -wi-ao   7.91G                                       /dev/vda2(0)  
  LogVol01 VolGroup00 -wi-ao   1.97G                                       /dev/vda2(253)
  testLV   testVG     owi-a-   1.00G                                       /dev/vdb1(0)  
  testsnap testVG     swi-a- 100.00M testLV   0.01                         /dev/vdb1(256)
# vgs -a
  VG         #PV #LV #SN Attr   VSize VFree
  VolGroup00   1   2   0 wz--n- 9.88G    0 
  testVG       2   2   1 wz--n- 3.99G 2.89G

If the user tries to extend the filesystem with associated snapshot, it would throw an error as shown below.

# lvextend -L +1G /dev/testVG/testLV 
  Snapshot origin volumes can be resized only while inactive: try lvchange -an

The Solution

LVs with snapshot needs to be deactivated before extending/resizing since online resize of LVM partitions with snapshot is not possible. Follow the steps outlined below:

1. Deactivate the LVM partition first and verify the current size of the LV.

# lvchange -an /dev/testVG/testLV 
# lvs -a -o+devices
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices       
  LogVol00 VolGroup00 -wi-ao   7.91G                                       /dev/vda2(0)  
  LogVol01 VolGroup00 -wi-ao   1.97G                                       /dev/vda2(253)
  testLV   testVG     owi---   1.00G                                       /dev/vdb1(0)  
  testsnap testVG     swi--- 100.00M testLV                                /dev/vdb1(256)

2. Now perform the resize operation and verify the LV size again.

# lvextend -L +1G /dev/testVG/testLV 
  Extending logical volume testLV to 2.00 GB
  Logical volume testLV successfully resized
# lvs -a -o+devices
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices       
  LogVol00 VolGroup00 -wi-ao   7.91G                                       /dev/vda2(0)  
  LogVol01 VolGroup00 -wi-ao   1.97G                                       /dev/vda2(253)
  testLV   testVG     owi---   2.00G                                       /dev/vdb1(0)  
  testLV   testVG     owi---   2.00G                                       /dev/vdb1(281)
  testLV   testVG     owi---   2.00G                                       /dev/vdc1(0)  
  testsnap testVG     swi--- 100.00M testLV                                /dev/vdb1(256)

3. Next step is to resize the LVM snapshot associated with the LV.

# lvextend -L +100M /dev/testVG/testsnap
Extending logical volume testsnap to 200.00 MB
  Logical volume testsnap successfully resized

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. kpartx: command not found
  2. fsck: command not found
  3. How to Migrate CentOS/RHEL 6 iptables Rules to CentOS/RHEL 7 firewalld
  4. How to Change the Default Shell In Linux
  5. a2enconf Command Examples in Linux
  6. CentOS/RHEL: How to find the package with a missing file using YUM
  7. ssh-copy-id Command Examples in Linux
  8. restorecon: command not found
  9. einfo: command not found
  10. mke2fs: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright