How to increase disk space on a virtual Linux server hosted on VSphere ?

Today we will see an interesting article to understand how to increase disk space on a Virtual Linux server which is hosted on vSphere.

Lets have a look step by step.

1. Check out the available PVs on the server.

[root@ngelinux01 ~]# pvscan
  PV /dev/sdg    VG ngevolgroup         lvm2 [<1.20 TiB / 28.98 GiB free]
  PV /dev/sda2   VG rootvg          lvm2 [<39.47 GiB / 4.34 GiB free]
  Total: 2 [1.23 TiB] / in use: 2 [1.23 TiB] / in no VG: 0 [0   ]

[root@ngelinux01 ~]# pvs
  PV         VG      Fmt  Attr PSize   PFree
  /dev/sda2  rootvg  lvm2 a--  <39.47g  4.34g
  /dev/sdg   ngevolgroup lvm2 a--   <1.20t 28.98g

 

2. Ask Storage team to increase the space on specific LUN id as visible in “multipath -ll” command.

 

3. Rescan the paths on the server.

[root@ngelinux01 ~]# rescan-scsi-bus.sh
which: no multipath in (/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/VRTS/bin)
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 2.0
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 1 0 ...
OLD: Host: scsi0 Channel: 00 Id: 01 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 2 0 ...
OLD: Host: scsi0 Channel: 00 Id: 02 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 3 0 ...
OLD: Host: scsi0 Channel: 00 Id: 03 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 4 0 ...
OLD: Host: scsi0 Channel: 00 Id: 04 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 5 0 ...
OLD: Host: scsi0 Channel: 00 Id: 05 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 0 0 6 0 ...
OLD: Host: scsi0 Channel: 00 Id: 06 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
Scanning host 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 1 0 1 0 ...
OLD: Host: scsi1 Channel: 00 Id: 01 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 1 0 2 0 ...
OLD: Host: scsi1 Channel: 00 Id: 02 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 1 0 3 0 ...
OLD: Host: scsi1 Channel: 00 Id: 03 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 1 0 4 0 ...
OLD: Host: scsi1 Channel: 00 Id: 04 Lun: 00
      Vendor: 3PARdata Model: VV               Rev: 3313
      Type:   Direct-Access                    ANSI SCSI revision: 06
Scanning host 2 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning host 3 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 3 0 0 0 ...
OLD: Host: scsi3 Channel: 00 Id: 00 Lun: 00
      Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
      Type:   CD-ROM                           ANSI SCSI revision: 05
0 new or changed device(s) found.
0 remapped or resized device(s) found.
0 device(s) removed.
[root@ngelinux01 ~]#

 

4. Now resize the disk on which we have asked to increase the LUN size.

[root@ngelinux01 ~]# pvs
  PV         VG      Fmt  Attr PSize   PFree
  /dev/sda2  rootvg  lvm2 a--  <39.47g  4.34g
  /dev/sdg   ngevolgroup lvm2 a--   <1.20t 28.98g
[root@ngelinux01 ~]#

### Resize the physical volume
[root@ngelinux01 ~]# pvresize /dev/sdg
  Physical volume "/dev/sdg" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

###  Now check the increased size.
[root@ngelinux01 ~]# pvs
  PV         VG      Fmt  Attr PSize   PFree
  /dev/sda2  rootvg  lvm2 a--  <39.47g   4.34g
  /dev/sdg   ngevolgroup lvm2 a--    1.68t 528.98g

[root@ngelinux01 ~]# vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  ngevolgroup   1   1   0 wz--n-   1.68t 528.98g
  rootvg    1  14   0 wz--n- <39.47g   4.34g

 

5. Now extend the disk partition.

[root@ngelinux01 ~]# df -h /dev/mapper/ngevolgroup-ngevolgroup
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/ngevolgroup-ngevolgroup      1.2T  1.2T     0 100% /NGEL_production

[root@ngelinux01 ~]# vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  ngevolgroup   1   1   0 wz--n-   1.68t 528.98g
  rootvg    1  14   0 wz--n- <39.47g   4.34g


[root@ngelinux01 ~]# lvextend -r -L +500G /dev/mapper/ngevolgroup-ngevolgroup
  Size of logical volume ngevolgroup/ngevolgroup changed from <1.17 TiB (305920 extents) to <1.66 TiB (433920 extents). Logical volume ngevolgroup/ngevolgroup successfully resized. resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/mapper/ngevolgroup-ngevolgroup is mounted on /NGEL_production; on-line resizing required old_desc_blocks = 150, new_desc_blocks = 212 The filesystem on /dev/mapper/ngevolgroup-ngevolgroup is now 444334080 blocks long. 


[root@ngelinux01 ~]# df -h /dev/mapper/ngevolgroup-ngevolgroup 
Filesystem Size Used Avail Use% Mounted on 
/dev/mapper/ngevolgroup-ngevolgroup 1.7T 1.2T 413G 75% /NGEL_production 

As we can see above, finally we have increased the partition by 500GB for a disk hosted on Vsphere virtual server.

Leave a Reply

Your email address will not be published.