Re-sizing disk partition linux/vm

Posted by Tiffany Walker on Server Fault See other posts from Server Fault or by Tiffany Walker
Published on 2013-02-13T19:38:37Z Indexed on 2014/06/10 3:28 UTC
Read the original article Hit count: 394

I VM Player running a linux guest and I was wanting to know how do I expand the disk? In the VM player I gave more disk space but I am not sure how to mount/expand/connect the new disk space to the system.

My old disk space was 14GB

[root@localhost ~]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       14G  4.5G  8.2G  36% /

Then I expanded it and now I see sda2 which is the new space?

[root@localhost ~]# fdisk -l

Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x000cd44d

   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/VolGroup-lv_root: 14.5 GB, 14537457664 bytes
255 heads, 63 sectors/track, 1767 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/VolGroup-lv_swap: 6408 MB, 6408896512 bytes
255 heads, 63 sectors/track, 779 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

Do I need to mount the new space first?

resize2fs -p /dev/mapper/VolGroup-lv_root 108849018880
resize2fs 1.41.12 (17-May-2010)
The containing partition (or device) is only 3549184 (4k) blocks.
You requested a new size of 1474836480 blocks.

 resize2fs -p /dev/mapper/VolGroup-lv_root 128849018880
resize2fs 1.41.12 (17-May-2010)
resize2fs: Invalid new size: 128849018880

[root@localhost ~]# lvextend -L+90GB /dev/mapper/VolGroup-lv_root
  Extending logical volume lv_root to 103.54 GiB
  Insufficient free space: 23040 extents needed, but only 0 available

[root@localhost ~]# lvextend -L90GB /dev/mapper/VolGroup-lv_root
  Extending logical volume lv_root to 90.00 GiB
  Insufficient free space: 19574 extents needed, but only 0 available

EDIT: So after trying pvcreate/vgextend nothing has so far worked. I'm guessing the new disk space added from VM Player is not showing up?

pvscan
  PV /dev/sda2   VG VolGroup   lvm2 [19.51 GiB / 0    free]
  Total: 1 [19.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 0 [0   ]

© Server Fault or respective owner

Related posts about linux

Related posts about filesystems