lvm commands

show physical volume

pvdisplay
pvdisplay -m
pvdisplay -C
[root@centos ~]# lvs -o +devices
 
LV                                   VG                                              Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices
6a8853c1-b0d5-86a0-5580-5447327106cd XSLocalEXT-6a8853c1-b0d5-86a0-5580-5447327106cd -wi-ao---- 29.96g                                                     /dev/sdb(0),/dev/sdc3(0),/dev/sda(0)
[root@centos ~]# lvs --segments -o +devices
 
LV                                   VG                                              Attr       #Str Type    SSize  Devices
6a8853c1-b0d5-86a0-5580-5447327106cd XSLocalEXT-6a8853c1-b0d5-86a0-5580-5447327106cd -wi-ao----    3 striped 29.96g /dev/sdb(0),/dev/sdc3(0),/dev/sda(0)

show logical volume groups

[root@centos ~]# vgdisplay

show logical volume

[root@centos ~]# lvdisplay

resize physical volume

You can use gparted live ios - do the partition magic …. and after that, resize the logical volume and extent the filesystem.

Rescan Host:

[root@centos ~]# echo "- - -" >/sys/class/scsi_host/host0/scan

check hd:

[root@centos ~]# fdisk -l
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4952fe1d
 
Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048    411647    409600  200M 83 Linux
/dev/sda2        411648   8800255   8388608    4G 82 Linux swap / Solaris
/dev/sda3       8800256 209715199 200914944 95.8G 8e Linux LVM

or user cfdisk / parted:

cfdisk

Get MB of free space:

parted
unit MB
print

Get the size of the disk in MB

parted /dev/sda resizepart 2

Enter size in MB - e.g. 24242MB

resize

[root@centos ~]# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

check

[root@centos ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda3  vg00 lvm2 a--  95.80g 70.00g

resize logical volume

resize logical volume

[root@centos ~]# lvextend -l +100%FREE <path to lv e.g./dev/fsilun/lvfsilun>
 
File descriptor 7 (pipe:[13154434]) leaked on lvextend invocation. Parent PID 3865: bash
  Size of logical volume fsilun/lvfsilun changed from 250.00 GiB (64000 extents) to 1000.00 GiB (256000 extents).
  Logical volume lvfsilun successfully resized

and than resize filesystem

[root@centos ~]# resize2fs -p /dev/fsilun/lvfsilun
 
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/fsilun/lvfsilun is mounted on /mnt/fsi; on-line resizing required
old desc_blocks = 16, new_desc_blocks = 63
Performing an on-line resize of /dev/fsilun/lvfsilun to 262144000 (4k) blocks.
The filesystem on /dev/fsilun/lvfsilun is now 262144000 blocks long.


Authors:
  • Jochen Schnuerle