• 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

lvresize command examples in Linux

by admin

If you are running out of space and you want to add more space to your LVM volume, you can use the lvresize command to do so. To do that, unmount the volume and use the lvresize command. (Actually, it is not required that you unmount the volume to grow it, but it is done as an extra precaution.) After that, you must also check the filesystem with e2fsck and run resize2fs to resize the ext4 filesystem on that volume:

1. Umount the mount point:

# umount /data

2. Perform the resize operation:

# lvresize --size 2G /dev/vg_name/lv_name

In the example just shown, the volume and the filesystem are both resized to 2GB.

3. Run the fsck:

# e2fsck -f /dev/vg_name/lv_name

4. Next, mount the volume again and check the disk space:

# mount -t ext4 /dev/vg_name/lv_name /data
# df -h /data

lvresize command examples

1. To resize a logical volume (in units of logical extents)

# lvresize -l [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}]
# lvresize --extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}]

2. To do not perform fsck before resizing filesystem when filesystem requires it:

# lvresize -n
# lvresize --nofsck

3. To disable udev synchronization:

# lvresize --noudevsync

4. To resize underlying filesystem together with the logical volume using fsadm:

# lvresize -r
# lvresize --resizefs

5. To change or set the logical volume size in units of megabytes:

# lvresize -L [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
# lvresize --size [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]

6. To gives the number of stripes to use when extending a Logical Volume:

# lvresize -i stripes
# lvresize --stripes stripes

7. To gives the number of kilobytes for the granularity of the stripes

# lvresize -I StripeSize
# lvresize --stripesize StripeSize
lvextend command examples in Linux

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. cpufreq-set Command Examples in Linux
  2. How to work with multiple java versions under Linux
  3. How to Ignore/Disable Specific auditd Logging Entries
  4. How to block a specific IP Connecting to a server with firewall-cmd
  5. What are Shell Scripts? How to Create Shell Scripts?
  6. ifrename Command Examples in Linux
  7. nordvpn Command Examples in Linux
  8. CentOS / RHEL : How to remove a mirror with mdadm
  9. pvs Command Examples in Linux
  10. du: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright