22.4 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

How to resize an Online Multipath Device

Resizing an Online Multipath Device is one you tasks as a Unix/Linux Administrator. From Storage  support you got an call or email that storage  device  with Lun ID X has been expanded from 100 to 200G.

Howo to make this visible in your system ?  lets  start  with basic  commands

#multipath -ll

oracle (0000000am7000000000000581) dm-6 IBM ,2145
size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 2:0:1:3 sdr 65:16 active ready running
| `- 1:0:1:3 sdq 65:0 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
|- 1:0:0:3 sdh 8:112 active ready running
`- 2:0:0:3 sdg 8:96 active ready running
- Advertisement -

U see  that oracle alias is 100Gb and have 4 disk devices sdr sdq sdh sdg

[root@]# fdisk -l /dev/sdr

Disk /dev/sdr: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@ ~]# fdisk -l /dev/sdq

Disk /dev/sdq: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@ ~]# fdisk -l /dev/sdh

Disk /dev/sdh: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@ ~]# fdisk -l /dev/sdg

Disk /dev/sdg: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

Rescan the disks to detect  thew new sizes 

You do it like this

# echo 1 > /sys/block/sdr/device/rescan
# echo 1 > /sys/block/sdq/device/rescan
# echo 1 > /sys/block/sdh/device/rescan
# echo 1 > /sys/block/sdg/device/rescan

Check  the news  size now

[root@~]# fdisk -l /dev/sdr

Disk /dev/sdr: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@~]# fdisk -l /dev/sdq

Disk /dev/sdq: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@~]# fdisk -l /dev/sdh

Disk /dev/sdh: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

[root@~]# fdisk -l /dev/sdg

Disk /dev/sdg: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes

You see that affected visible devices are now 200GB .

Resize the multipathszie

use this command

# multipath resize map oracle

Show multipath topology (maximum info) with command   multipath -ll

#systemctl reload multipathd
#multipath -ll 
oracle (360050768018085dc7000000000000367) dm-6 IBM     ,2145
size=200G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 1:0:1:3 sdq 65:0  active ready running
| `- 2:0:1:3 sdr 65:16 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 1:0:0:3 sdh 8:112 active ready running
  `- 2:0:0:3 sdg 8:96  active ready running

The new size is visible and 200GB

Resize the affected partition on the system 

The   /dev/mapper/oracle is part of vg01 volume group

First resize the

]# df -h
Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg01-app 100G 74G 27G 74% /app
/dev/mapper/vg00-tmp 2.0G 46M 2.0G 3% /tmp
/dev/mapper/vg00-var 4.0G 1.8G 2.3G 45% /var
/dev/mapper/vg00-home 1014M 282M 733M 28% /home

Resize the physical volume

# pvresize /dev/mapper/oracle
Physical volume "/dev/mapper/oracle" changed
1 physical volume(s) resized / 0 physical volume(s) not resized

Or

#pvresize --setphysicalvolumesize 200G /dev/mapper/oracle

check pvdiplay if pv now 200GB

[root@~]# pvdisplay


--- Physical volume ---
PV Name /dev/mapper/oracle
VG Name vg01
PV Size <200.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 51199
Free PE 25600
Allocated PE 25599
PV UUID 0A141S-htsn-Y70k-PE90-IdJF-uJjn-Xm9ixF

Extend the Logical volume 100%

# lvextend -l +100%FREE /dev/mapper/vg01-app
Size of logical volume vg01/app changed from <100.00 GiB (25599 extents) to <200.00 GiB (51199 extents).
Logical volume vg01/app successfully resized.

Make this change permanent by adding the space to the mounted partition

Im using  XFS file system . i will use  xfs_growfs to   extend the partition

[root@~]# xfs_growfs /dev/mapper/vg01-app
meta-data=/dev/mapper/vg01-app isize=256 agcount=16, agsize=1638336 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=26213376, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=12799, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 26213376 to 52427776

Check the new partition size and smill

[root@~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-root 8.0G 1.9G 6.2G 23% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 641M 31G 2% /dev/shm
tmpfs 32G 2.8G 29G 9% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/vg01-app 200G 74G 127G 37% /app
/
tmpfs 6.3G 0 6.3G 0% /run/user/996
tmpfs 6.3G 0 6.3G 0% /run/user/4000
tmpfs 6.3G 0 6.3G 0% /run/user/0
tmpfs 6.3G 0 6.3G 0% /run/user/61029
[root@su444p018 ~]#

Please Enjoy and  let us know if u need any extra help. Cheers!!

You can  also consult

How to remove LUN Storage device (LUN) from Linux server

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article