How to resize LVM logical volume

Argomenti vari di carattere sistemistico
Post Reply
daniele
Posts: 327
Joined: 04 Mar 2009, 13:59

How to resize LVM logical volume

Post by daniele »

1) Use resize2fs to increase and decrease a filesystem size
http://fibrevillage.com/storage/315-use ... ystem-size

2) Removing a Disk from a Logical Volume
https://access.redhat.com/documentation ... _remove_ex

3) LVM Resize – How to Decrease an LVM Partition
https://www.rootusers.com/lvm-resize-ho ... partition/


Use lvresize to resize both lv and filesystem size
The following command will shrink reduce by 10GB the size of both the logical volume and the filesystem:

Code: Select all

lvresize -r -L -10g /dev/mapper/vg0-lvol0
Check what (and how much) physical disks are being used in a volume group

Code: Select all

pvs -o+pv_used
Remove a physical disk (/dev/sdb1) from a volume group (myvg)

Code: Select all

vgreduce myvg /dev/sdb1
Identify a virtual disk (i.e. a VHD or a VMDK) no more in use and safely remove it from the hypervisor
In modern Linux distros you can use this command to.

Code: Select all

sudo ls /sys/block/sd*/device/*
For instance you could have results similar to the following:

Code: Select all

/sys/block/sdj/device/scsi_device:
1:0:0:6
From that info you will be able to know that the disk sdj is attached to the controller (either physical or virtual) 1 at number 6
Post Reply