Archive

Archive for June, 2015

Add additional disk space to disk in CentOS or RHEL

June 15, 2015 Leave a comment

There are multiple steps required to get this done. Below is a simple basic guide with commands:

  • Download gparted.iso (link) and boot to gparted
  • Deactive the disk you want to resize
  • Resize the disk
  • Apply the changes to the disk
  • Reboot into CentOS or RHEL and run the commands:

    1. lvm vgdisplay

    Output:
    [user@Server~]# lvm vgdisplay
    — Volume group —
    VG Name               VolGroup
    System ID
    Format                lvm2
    Metadata Areas        1
    Metadata Sequence No  4
    VG Access             read/write
    VG Status             resizable
    MAX LV                0
    Cur LV                2
    Open LV               2
    Max PV                0
    Cur PV                1
    Act PV                1
    VG Size               99.51 GiB
    PE Size               4.00 MiB
    Total PE              25474
    Alloc PE / Size       4994 / 19.51 GiB
    Free  PE / Size       20480 / 80.00 GiB
    VG UUID               iKGKSv-WEVw-0vNB-pRQO-8a5T-q4Z4-8knkhN

    2.  lvm vgdisplay (take a note of the volume you want to extend)

    Output:
    [user@server~]# lvm lvdisplay
    — Logical volume —
    LV Path                /dev/VolGroup/lv_root
    LV Name                lv_root
    VG Name                VolGroup
    LV UUID                9nSUAm-9Krp-itTW-YuZc-XgtG-m8GS-5C4dLx
    LV Write Access        read/write
    LV Creation host, time ,
    LV Status              available
    # open                 1
    LV Size                95.60 GiB
    Current LE             24474
    Segments               2
    Allocation             inherit
    Read ahead sectors     auto
    – currently set to     256
    Block device           253:0

    3. Run lvextend -l +100%FREE /dev/VolGroup/lv_root

    Output:
    Size of logical volume VolGroup/lv_root changed from 15.60 GiB (3994 extents) to 95.60 GiB (24474 extents).
    Logical volume lv_root successfully resized

    4. Run lvm vgdisplay to confirm the new disk size

    5. Run resize2fs -p /dev/VolGroup/lv_root (this will add the extra space to the volume)

    6. Run df -h to confirm that the new volume size has been applied

    Output:
    [user@server log]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
    94G   15G   75G  17% /
    tmpfs                 935M     0  935M   0% /dev/shm
    /dev/xvda1            477M   92M  360M  21% /boot

Advertisements