• 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. How to use wget to download file via proxy
  2. How to Create, restore, and delete snapshots of virtual machine images in RedHat Virtualization
  3. CentOS / RHEL 7 : systemctl replacements of legacy commands service and chkconfig
  4. lvremove Command Examples in Linux
  5. chcon command examples in Linux
  6. How the BASH Shell load its configuration files in Linux
  7. iSCSI troubleshooting : Targets Not Detected After Reboot
  8. Downgrading an rpm package to a lower version (using “rpm” command)
  9. CentOS / RHEL : How to block incoming and outgoing ports using iptables
  10. How to disable lvmetad in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright