Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After increasing the size of my Ubuntu 12.04 LTS VM's OS disk by editing the guest VM's settings through the vSphere client, I do not see the increase in disk size when I check from within the OS (df -h).

On a windows VM I went into disk manager and extended the volume to use the unallocated space (created by increasing the disk size). How do I ensure that the OS sees this disk space increase in Linux?

share|improve this question
Which Linux distribution are you running on your VM? – Univ426 Aug 22 '12 at 15:29
Ubuntu 12.04 LTS – Paddington Aug 23 '12 at 5:51
@Paddington how about accepting some answers to your questions? – Jeff Ferland Aug 23 '12 at 20:48
up vote 5 down vote accepted

The expanded disk size is unallocated and unpartitioned. You'll need to partition the new disk space first using fdisk or diskpart. After that, you may need to format the new partition. Depending on what kind of filesystem you're using, the commands will differ, but as an example, for ext3 you would call mkfs.ext3 Then depending on the OS, you'll be able to grow the logical volume. If you're using LVM, you can simply expand the original volume after you've partitioned/initialized the new space.

share|improve this answer
Many filesystems don't need to be blown away and reformatted to be grown. Ext{2,3,4}, XFS, etc. all allow online growth. – Jeff Ferland Aug 22 '12 at 20:18
Sorry, I wrote that wrong, upvote for you - I wasn't implying he blow away the entire volume. I just rewrote my answer, just let me know if it's still incorrect :) – Univ426 Aug 22 '12 at 20:27

The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.

1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

# fdisk -l

2) Get list of partitions for /dev/sda device:

# ls -al /dev/sda*

brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2

3) Create new primary partition

# fdisk /dev/sda

Then type:
  n (enter) [create new partition]
  p (enter) [primary partition]
  3 (enter) [next available number from listed /dev/sda partitions in 2)
  (enter)   [start cylinder]
  (enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
  t (enter) [change partition type]
  3 (enter) [selecting /dev/sda3 partition]
  8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types] 
  w (enter)

  The partition table has been altered!

4) Reboot Centos 6.X then log back in with root privileges

# reboot

5) Check the new partition is ready and type '8e':

# fdisk -l

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        2089    16264192   8e  Linux LVM
/dev/sda3            2089        3916    14678054   8e  Linux LVM

6) Create physical volume:

# pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created

7) Find out volume group name:

# vgdisplay

--- Volume group ---
VG Name               vg_app1

8) Extend the physical volume:

# vgextend vg_app1 /dev/sda3

Volume group "vg_app1" successfully extended

9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.

# lvextend -l +100%FREE /dev/vg_app1/lv_root

Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized

10) Resize logical root volume:

# resize2fs /dev/vg_app1/lv_root

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.

Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.

11) Check available space:

# df -h

Filesystem            Size  Used Avail Use% Mounted on
                      26G   10G   14G  42% /
tmpfs                 9.8G     0  9.8G   0% /dev/shm
/dev/sda1             477M   88M  364M  20% /boot
share|improve this answer

Your Answer


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.