Linux – Resize ext4 partition without losing data in virtual server

command-line-interfaceext4linuxlvmpartition

We have a virtual Linux server (Fedora Core 2.6.35.6-45.fc14.x86_64) running on VMWare vSphere. Initially it had 3 SCSCI drives 32Gb each. Now we have extended a disk that was mounted under "/home" to 256GB. But Linux server, obviously, does not see that change after restart. Is there a safe way to extend that ext4 partition from 32GB to 256GB withou losing any data?

I've made a search on Google before asking this question and many advice to use GParted. But it seems not the option for me now as I only have shell access to that server at the moment.

EDIT: This is an output from df:

[root@d0001-prf01 dmr]# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_d0011prf01-lv_root
              ext4    31705024   3385376  27997620  11% /
tmpfs        tmpfs     4098300        88   4098212   1% /dev/shm
/dev/sda1     ext4      495844     31317    438927   7% /boot
/dev/mapper/vg_d0011prf01-lv_home
              ext4    23674012  11840672  10630756  53% /home

I can provide more partition information if needed.

EDIT: I can see that LVM is set up on that Linux server:

lvm> lvs
  LV      VG            Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  lv_home vg_d0011prf01 -wi-ao 22.94g
  lv_root vg_d0011prf01 -wi-ao 30.72g
  lv_swap vg_d0011prf01 -wi-ao  9.81g

Does it mean I can use lvresize command?

Best Answer

Yes, looks like you can use lvresize, assuming you have space in the volume group.

See if you have some free space:-

sudo vgs -v vg_d0011prf01

If you do, then you can resize the volume using. the following will increase the size by 2Gig.

sudo lvextend -L+2G /dev/mapper/vg_d0011prf01-lv_home

Then resize the volume using resize2fs like:-

sudo resize2fs /dev/mapper/vg_d0011prf01-lv_home