Online LUN expansion (Step-by-Step)

As with many things in life, it is easy to outgrow the environment you find yourself in.  When looking a LUNs and using LVM we can easily accommodate resizing of the back end storage and transferring this through the to volume presented to your RHEL server.

Note. The following details presenting a brand new LUN to the server rather than trying to expand the existing underlying LUN, as I feel this is a safer option.

The following provides a rough guide to the steps require;

  • Create new LUN and export to server
  • Configure multipathing
  • Create partition and set it touseLVM
    • parted /dev/mapper/new_lun
    • parted> mklabel gpt
    • parted> mkpart new_name ext4 0% 100%
    • parted> set 1 lvm on
    • parted> q
  • Run pvcreate on raw device file /dev/mapper/whateverp1
  • Run vgextend vol_group pv_dev
  • Run pvmove old_pv_dev new_pv_dev (this step will take a long time if the LUN is huge)
  • Run vgreduce vg_name old_pv_dev
  • pvremove old_pv_dev
  • Run lvextend -l +100%FREE /dev/vol_group/logical_vol
  • Run resize2fs /dev/vol_group/logical_vol

If you now run `df -h` you should see the file system has grown to the size of the new LUN.

Leave a Reply