Extend the partition on Linux

** Check the current partation
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
9.3G 8.8G 72M 100% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 485M 32M 429M 7% /boot

** Unmount the device ( but not successful 🙂 )
[root@localhost ~]# umount /dev/mapper/VolGroup-lv_root
umount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))

** Extend the partation ( all free space )

[root@localhost ~]# lvextend -l +100%FREE /dev/VolGroup/lv_root
Extending logical volume lv_root to 93.43 GiB
Logical volume lv_root successfully resized

** Resize to extended partation

[root@localhost ~]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 6
Performing an on-line resize of /dev/VolGroup/lv_root to 24492032 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 24492032 blocks long.
** Remount the /home directory
[root@localhost ~]#mount -a
** Verification 🙂

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
92G 8.8G 79G 11% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 485M 32M 429M 7% /boot

Read More