Resize/extend partition size CentOS

centos6hard drivepartition

Im tasked to resize a partition on a remote server. I've read up on it and understand that i'll need unmount and use resize2fs /dev/sdato expand the partition size. Can someone please help me unmount the partition or direct me to a guide to achieve this, details of the setup:

UPDATE, the disk space is now 200gb but still need help to expand the partition to its full size

fdisk -l 

outputs

   Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00080e9a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/mapper/vg_livecd-lv_root: 18.8 GB, 18832424960 bytes
255 heads, 63 sectors/track, 2289 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_livecd-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_livecd-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_livecd-lv_swap doesn't contain a valid partition table

and

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
                       18G  2.8G   15G  17% /
tmpfs                1004M     0 1004M   0% /dev/shm
/dev/sda1             485M   33M  427M   8% /boot

Best Answer

in most cases you can resize your filesystem online, there is no need to umount it.

it looks like you are using LVM so in high level your steps are:

  • add another LVM partition to your disk
  • add this partition as a physical volume to your volume group
  • resize your logical volume
  • use resize2fs to expand your filesystem to the new size
Related Topic