In Linux server, How to extend the SAN disk under LVM , after the LUN expanded from SAN?
This article will explain you, how to do this. we are going to expand size of the SAN disk which is 20GB to 75GB under LVM. Basically, Linux detects the new size after a LUN scan, but LVM won't recognize expanded size of the disk. Let us see, how we are going to achieve this.
1. Scan for new LUNS. Refer Scan and Configure New LUNS for scanning LUNS in Linux
2. After scanning, check physical size of the drive now.
# fdisk -l /dev/sdb
Disk /dev/sdb: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Now, Linux recognized the new size as 75 GB.
3. Check the LVM
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 system lvm2 a- 16.89G 2.92G
/dev/sdb system2 lvm2 a- 20.00G 96.00M
This command still reported 20GB for the LVM disk, Lets do a scan now:
# pvscan
# vgscan
# lvscan
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 system lvm2 a- 16.89G 2.92G
/dev/sdb system2 lvm2 a- 20.00G 96.00M
4. After the scan also, LVM still reports the disk as 20GB. So let us extend the size manually.
# pvresize --setphysicalvolumesize 70G /dev/sdb
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 system lvm2 a- 16.89G 2.92G
/dev/sdb system2 lvm2 a- 70.00G 96.00M
Now LVM reports the new size of the disk. Let us do a scan again, so that VG takes this new PV size into account.
# pvscan
# vgscan
# lvscan
5. Now, we can extend the logical volume size:
# lvextend -L +50G /dev/system2/app
# resize_reiserfs /dev/system2/app
# pvs
# vgs
VG #PV #LV #SN Attr VSize VFree
system 1 5 0 wz--n- 16.89G 2.92G
system2 1 1 0 wz--n- 70.00G 96.00M
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
Opt system -wi-ao 2.00G
root system -wi-ao 1.00G
tmp system -wi-ao 2.00G
usr system -wi-ao 2.97G
var system -wi-ao 6.00G
app system2 -wi-a- 69.90G
6. Finally verify the space
# df -h /app
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system2-app
70G 5.5G 65G 8% /app
Thats all..! we are done..enjo
No comments:
Post a Comment