DbAppWeb.com

Menu
  • Home
  • Linux
  • HP-UX
  • macOS
  • Windows
  • Web Servers
  • App Servers
  • Storage

How to Resize an Online Multipath Device in Linux

August 29, 2020 DbAppWeb Admin

Problem

I have a LUN of 2GB which is exported to one of my Red Hat Enterprise Linux (RHEL) servers. This volume is being used on the server and mounted on /rcptest. I need to increase this virtual volume from 2GB to 10GB on the storage side and then I need to increase the same on the RHEL server. I have to do all these activities online i.e. without rebooting the server or without removing the mounting.

[root@dbappweb.com ~]# multipath -ll mpathh
mpathh (360002ac000000000000065c000010b4b) dm-4 3PARdata,VV
size=2G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  |- 1:0:0:5  sde  8:64   active ready running
  |- 2:0:0:5  sdaa 65:160 active ready running
  |- 1:0:2:5  sdo  8:224  active ready running
  `- 2:0:2:5  sdak 66:64  active ready running

This volume is in LVM and mounted on /rcptest

[root@dbappweb.com ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rcptest-lvrcptest
                      2.0G  1.3G  576M  69% /rcptest

 

Solution

To increase the size of the volume first we have to increase the size of the virtual volume on the storage side. Once it will be increased from 2GB to 10GB on the storage side then we can increase the same on the RHEL server. Follow the steps given below to increase the size on volume online:

  • Increase the size of virtual volume from 2GB to 10GB on storage.
  • Resize the multipath device by executing the multipath resize command. Here multipath device name is mpathh which is already shown in multipath -ll.
    [root@dbappweb.com ~]# multipathd resize map /dev/mapper/mpathh
    ok
  • Now the size of the multipath device has been increased from 2GB to 10GB as shown below.
    [root@dbappweb.com ~]# multipath -ll mpathh
    mpathh (360002ac000000000000065c000010b4b) dm-4 3PARdata,VV
    size=10G features='0' hwhandler='0' wp=rw
    `-+- policy='round-robin 0' prio=1 status=active
      |- 1:0:0:5  sde  8:64   active ready running
      |- 2:0:0:5  sdaa 65:160 active ready running
      |- 1:0:2:5  sdo  8:224  active ready running
      `- 2:0:2:5  sdak 66:64  active ready running
  • Create a new primary partition using the fdisk command and give the partition number 2 to it as portion number 1 was already created.
    [root@dbappweb.com ~]# fdisk /dev/mapper/mpathh
    
    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
    
    Command (m for help): m
    Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First cylinder (1-1305, default 262):
    Using default value 262
    Last cylinder, +cylinders or +size{K,M,G} (262-1305, default 1305):
    Using default value 1305
    
    Command (m for help): p
    
    Disk /dev/mapper/mpathh: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 16384 bytes / 16777216 bytes
    Disk identifier: 0xf3ced09e
    
                 Device Boot      Start         End      Blocks   Id  System
    /dev/mapper/mpathhp1               3         261     2080417+  83  Linux
    Partition 1 does not start on physical sector boundary.
    /dev/mapper/mpathhp2             262        1305     8385930   83  Linux
    Partition 2 does not start on physical sector boundary.
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 22: Invalid argument.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
  • In the above step, a warning is shown that “Re-reading the partition table failed with error 22: Invalid argument.”. To resolve this run the kpartx command.
    [root@dbappweb.com ~]# kpartx -av -p p /dev/mapper/mpathh
    add map mpathhp1 (253:14): 0 4160835 linear /dev/mapper/mpathh 32130
    add map mpathhp2 (253:30): 0 16771860 linear /dev/mapper/mpathh 4192965
  • Run the fdisk -l command to verify the created partitions.
    [root@dbappweb.com ~]# fdisk -l /dev/mapper/mpathh
    
    Disk /dev/mapper/mpathh: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 16384 bytes / 16777216 bytes
    Disk identifier: 0xf3ced09e
    
                 Device Boot      Start         End      Blocks   Id  System
    /dev/mapper/mpathhp1               3         261     2080417+  83  Linux
    Partition 1 does not start on physical sector boundary.
    /dev/mapper/mpathhp2             262        1305     8385930   83  Linux
    Partition 2 does not start on physical sector boundary.
  • Create the physical volume for /dev/mapper/mpathhp2 using pvcreate command
    [root@dbappweb.com ~]# pvcreate /dev/mapper/mpathhp2
      Physical volume "/dev/mapper/mpathhp2" successfully created
  • Extend the volume group vgrcptest, using vgextend command.
    [root@dbappweb.com ~]# vgextend rcptest /dev/mapper/mpathhp2
      Volume group "rcptest" successfully extended
  • Verify the VG size, which has been increased to 9.95GB but the LV size is still 1.96GB.
    [root@dbappweb.com ~]# vgdisplay -v rcptest
        Using volume group(s) on command line.
      --- Volume group ---
      VG Name               rcptest
      System ID
      Format                lvm2
      Metadata Areas        2
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                1
      Open LV               1
      Max PV                0
      Cur PV                2
      Act PV                2
      VG Size               9.95 GiB
      PE Size               4.00 MiB
      Total PE              2546
      Alloc PE / Size       503 / 1.96 GiB
      Free  PE / Size       2043 / 7.98 GiB
      VG UUID               LLiW6z-9rhi-1cPj-LA0v-eW9C-HTMA-7TDdYS
    
      --- Logical volume ---
      LV Path                /dev/rcptest/lvrcptest
      LV Name                lvrcptest
      VG Name                rcptest
      LV UUID                VcJcMw-akzU-PZEI-v8bn-TU63-BjOV-Cdn9Wc
      LV Write Access        read/write
      LV Creation host, time dbappweb.com, 2017-05-11 17:03:04 +0530
      LV Status              available
      # open                 1
      LV Size                1.96 GiB
      Current LE             503
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:27
    
      --- Physical volumes ---
      PV Name               /dev/mapper/mpathhp1
      PV UUID               AXBOp6-nhRs-cijS-oA3g-n3fV-5c1K-rH8V0h
      PV Status             allocatable
      Total PE / Free PE    503 / 0
    
      PV Name               /dev/mapper/mpathhp2
      PV UUID               CbSixg-zJGD-ziR0-D0eF-qryR-JoWR-1NXfT4
      PV Status             allocatable
      Total PE / Free PE    2043 / 2043
  • Extend the logical volume using the command lvextend, you may verify it by using the command lvdisplay
    [root@dbappweb.com ~]# lvextend -l +100%FREE /dev/rcptest/lvrcptest
      Size of logical volume rcptest/lvrcptest changed from 1.96 GiB (503 extents) to 9.95 GiB (2546 extents).
      Logical volume lvrcptest successfully resized.
  • Resize the filesystem by using the resize2fs command.
    [root@dbappweb.com ~]# resize2fs /dev/rcptest/lvrcptest
    resize2fs 1.41.12 (17-May-2010)
    Filesystem at /dev/rcptest/lvrcptest is mounted on /rcptest; on-line resizing required
    old desc_blocks = 1, new_desc_blocks = 1
    Performing an on-line resize of /dev/rcptest/lvrcptest to 2607104 (4k) blocks.
    The filesystem on /dev/rcptest/lvrcptest is now 2607104 blocks long.
    
  • Verify the filesystem, it has been increased to 10 GB.
    [root@dbappweb.com ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/rcptest-lvrcptest
                          9.8G  1.3G  8.1G  14% /rcptest

Last Updated: August 29, 2020

Related Posts

  • Create PV, VG, LV and format it in Linux when Multipath Enabled
  • How to remove File System, LV and VG in HP-UX and Linux?
  • How to extend the size of Logical Volume (LV) in HP-UX
  • Create a Logical Volume larger than 2TB and format it in Linux/RHEL

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
Prev Article
Next Article
Tags:File System Linux RedHat Linux Storage Admin Sys Admin

Leave a Reply Cancel Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Popular
  • Recent

Categories

  • Android (2)
  • Blogger (16)
  • Domain and Hosting (1)
  • Hardware Issues (7)
  • HP-UX (55)
  • HPE Data Protector (9)
  • IBM Lotus Notes (2)
  • IBM WebSphere Application Server (16)
  • Internet Tips & Tricks (15)
  • iOS (8)
  • JBoss/WildFly Application Server (2)
  • Linux (76)
  • macOS (15)
  • Microsoft Windows (31)
  • News and Updates (11)
  • Oracle Database (5)
  • SSL/TLS (1)
  • Storage Servers (23)
  • Tools/Softwares (1)
  • VMware ESXi (17)
  • Web Servers (14)
  • WordPress (5)

Archives

DbAppWeb.com

Solution of Database, Application and Web Server Problems

About DbAppWeb.com

One Stop Solution for Database Server, Application Server and Web Server Problems.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

DbAppWeb on Social Media

Copyright © 2025 DbAppWeb.com
Terms and Conditions   Theme by MyThemeShop.com