HOWTO: add disk to VMware Ubuntu guest without reboot using LVM

This howto is mostly built on the great tutorial available at…hout-reboot/. My spot tries to be more Ubuntu and LVM specific. This manual was tested on Ubuntu 9.04 (jaunty) Server edition guest OS.

Add Virtual Hard Disk

add-disk1 A new hard disk can be added easily to a running virtual machine in VMWare Infrastructure Web Access by clicking Add Hardware and following the wizard.

Note: I assume that all of the commands given are run under superuser (root) rights. To become root type

sudo su root

Detect new SCSI Disk

The package scsitools provides the script, which does exacly what we need. Install it and run it:

apt-get install scsitools

This should detect the newly added hard disk and make it available in /dev/ – /dev/sdb in the case you are adding a new drive for the first time. The output of fdisk -l should include the newly detected disk.

Format the new disk

Format the newly detected drive using fdisk

fdisk /dev/sdb
    n (for new partition)
    p (for primary partition)
    1 (partition number)
    (keep the other values default)
    w (write changes)

Change the type of the partition to LVM Linux:

fdisk /dev/sdb
    t (change the partition type)
    8e (for Linux LVM)
    w (write changes)


Initialize LVM Physical Volume

pvcreate /dev/sdb1

Add Physical Volume to Volume Group

List the Volume groups available at your machine.


Replace VolGroupName with what you read from the output of the last command.

vgextend VolGroupName /dev/sdb1

You should see the newly aquired free space in the output of


Resize Logical Volumes

After adding some free space to your Volume Group, you can distribute it to the Logical Volumes. The list of Logical Volumes can be obtained by running


Run the following commands for each Logical Volume you want to resize (add space to). Again – replace /dev/VolGroupNa­me/Name with the Logical Volume name you can read from the output of the last command. The +10G means Add 10 GB

lvextend -L +10G /dev/VolGroupName/Name

The last step is to resize the ext3 filesystem (use different tool is you use different filesystem):

resize2fs /dev/VolGroupName/Name

Tags: , ,

4 Responses to “HOWTO: add disk to VMware Ubuntu guest without reboot using LVM”

  1. TordeK says:

    perfect!!! exactly what i was after. Saved me a lot of time trying to figure out the commands myself.

    Cheers :)

  2. vasik says:

    i every manual were like this the world would be much better. THANKS!

  3. dnilson says:

    solid response – very appreciated as VMware converter choked o nthis particular machine and I had to go it longhand.

    I didnt know about, the rest was familar, but you saved me the time of looking up the exact CM options


  4. pravink.22 says:

    Thxs buddy.. !!!!
    Check below mentioned url, very easy to understand…manager.html