• 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

lvextend command examples in Linux

by admin

Logical Volume Manager 2 (LVM2) allows you to aggregate physical storage devices into volume groups. You can then divide that aggregated space into one or more logical volumes. Once created, logical volumes can be extended to utilize unused space within the volume group, allowing the file system residing on the logical volume to be extended as well.

The lvextend command is used to extend the logical volume. Before we use lvextend there are few steps that need to be followed. The following are sample steps to extend a Volume Group (VG), a Logical Volume (LV), and a filesystem using a device named /dev/sdN as its Physical Volume (PV).

1. Create a PV from a free disk or partition (e.g. /dev/sdN1 as a partition):

# pvcreate /dev/sdN1

You can also use a complete disk to create a physical volume with pvcreate.

2. Extend the VG (/dev/sdN1 is an existing PV path):

# vgextend vgdata /dev/sdN1

Extend the LV and resize the underlying filesystem together (/dev/vgdata/lvdata is the existing LV path), which will be extended by 125 GB:

# lvextend -r -L +125G /dev/vgdata/lvdata

Examples of lvextend command

1. To disable the udev synchronization

# lvextend --noudevsync

2. To Extend or set the logical volume size in units of logical extents

# lvextend -l +10%VG|LV|PVS|FREE|ORIGIN
# lvextend --extents +10%VG|LV|PVS|FREE|ORIGIN
# lvextend -l +10%VG
# lvextend -l +10%LV
# lvextend -l +10%PVS
# lvextend -l +100%FREE 

3. To Extend or set the logical volume size in units of megabytes

# lvextend -L [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
# lvextend --size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE] 

4. To Gives the number of stripes for the extension

# lvextend -i stripes
# lvextend --stripes stripes

5. To Gives the number of kilobytes for the granularity of the stripes

# lvextend -I stripesize
# lvextend --stripesize stripesize 

6. To Proceed with size extension without prompting

# lvextend -f
# lvextend --force

7. To do not perform fsck before extending filesystem when filesystem requires it

# lvextend -n
# lvextend --nofsck

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

# lvextend -r
# lvextend --resizefs
lvresize command examples in Linux

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. register_new_matrix_user: command not found
  2. dnstracer Command Examples in Linux
  3. fallocate: command not found
  4. srun: command not found
  5. Determining disk usage in Linux using “du” command
  6. service: command not found
  7. grub2-install: command not found
  8. “Metadata File Does Not Match Checksum” Issue When Yum Installs or Updates Package
  9. light Command Examples in Linux
  10. How to Configure Early-kdump Support Feature in CentOS/RHEL 8

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright