Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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   ]
share|improve this question
add comment

3 Answers 3

Since your underlying device is already extended, you should be able to see the available space in the output of vgdisplay. Look for the line that says Free PE / Size. If this is the case, you can simply extend the logical volume via lvextend and then grow the filesystem via resize2fs.

share|improve this answer
add comment

I did a guide how to do this a while back, hope this helps.

http://serverfault.com/a/422972/1435

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.