[CentOS] enlarging partition and its filesystem

Thu May 19 06:26:20 UTC 2016
Wes James <comptekki at gmail.com>

Can you get buy with using lvm features, i.e., just add the chunk to the
volume you want.

Use cfdisk to create a new partition (sudo cfdisk /dev/sda)

Select the unused space, create new partition and then select write, then
quit.

reboot for changes to take.  Go in to lvm, then finally use resize2fs and
your extra space will now be used in the system.

$ sudo lvm
lvm> pvcreate /dev/sda4
  Physical volume "/dev/sda4" successfully created

lvm> pvs
  PV         VG    Fmt  Attr PSize  PFree
  /dev/sda2  vg_c6 lvm2 a--  60.43g     0
  /dev/sda3  vg_c6 lvm2 a--  17.20g     0
  /dev/sda4        lvm2 ---  19.53g 19.53g

lvm> vgextend vg_c6 /dev/sda4
  Volume group "vg_c6" successfully extended

lvm> lvextend -l +100%FREE /dev/vg_c6/lv_home
  Size of logical volume vg_c6/lv_home changed from 22.06 GiB (5648
extents) to 41.59 GiB (10647 extents).
  Logical volume lv_home successfully resized

lvm> quit
  Exiting.

$ sudo resize2fs /dev/vg_c6/lv_home
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_c6/lv_home is mounted on /home; on-line resizing
required
old desc_blocks = 1, new_desc_blocks = 3
Performing an on-line resize of /dev/vg_c6/lv_home to 10902528 (4k) blocks.
The filesystem on /dev/vg_c6/lv_home is now 10902528 blocks long.

-------------

-wes





On Wed, May 18, 2016 at 1:33 PM, Fred Smith <fredex at fcshome.stoneham.ma.us>
wrote:

> Hi all!
>
> I've got a VM at work running C6 on HyperV (no, its not my fault,
> that's what the company uses. I'd rather gag myself than own one
> of th ose things.)
>
> I ran out of disk space in the VM, so the admin enlarged the virtual disk.
> but now I realize I don't know how to enlarge the partition and its
> filesystem.
>
> I'll be googling, but in case I miss it, it'd be great if someone could
> point me in the right direction.
>
> thanks!
>
> Fred
>
> --
>
> -------------------------------------------------------------------------------
>     Under no circumstances will I ever purchase anything offered to me as
>     the result of an unsolicited e-mail message. Nor will I forward chain
>     letters, petitions, mass mailings, or virus warnings to large numbers
>     of others. This is my contribution to the survival of the online
>     community.
>  --Roger Ebert, December, 1996
> ----------------------------- The Boulder Pledge
> -----------------------------
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>