Resizing LVM Partition of ESXi guest

10Jun09

I have a Ubuntu Server running as one of the virtual machine, as my standard practice, I only allocated 8GB for a vanilla installation. Today, one instance of the server requires far more than that, hence requires me to provision more. The thing is, if I had partitioned the virtual disk normally (without LVM), things would be simpler:

  1. Resize virtual disk from VI Client
  2. Boot the vm with gparted ISO and resize the partition. Gparted will recognize the simple non-LVM partition and will be able to resize it easily.
  3. Boot the os vm and resize the filesystem using resize2fs.

Things are a bit more complicated with LVM, but still pretty straightforward, especially once u understand more how LVM works.

  1. Resize virtual disk from VI Client
  2. Depending on the current partition layout, you might have to this part differently. Boot with Gparted, and resize the extended partition only. The Logical partition that contains the LVM would not be recognized by gparted hence it can’t resize it for you.
  3. Boot the VM and proceed with the following
    • Resize the physical volume pvresize or create new physical volume pvcreate (after creating LVM partition using fdisk)
      pvcreate /dev/sda6
    • if you create new physical volume, add it to the current group using vgextend
      vgextend VG /dev/sda6
    • Resize the logical volume using lvresize .
      lvresize -l +100%FREE /dev/VG/root
    • Resize the filesystem
      resize2fs /dev/VG/root

    For some reason pvresize won’t work for me, so I had to create new partition every time.

About these ads


No Responses Yet to “Resizing LVM Partition of ESXi guest”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: