Increasing the size of a Linux ext3 virtual machine disk
search cancel

Increasing the size of a Linux ext3 virtual machine disk

book

Article ID: 307884

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to increase the size of a ext3 machine disk or partition that is not managed by the Logical Volume Manager (LVM) in a Linux virtual machine.

Note: This article provides guidance on extending a virtual disk within a virtual machine, which is an operating system level operation and includes significant changes to a virtual machine disk. VMware recommends you to have a full backup of your virtual machine before attempting this procedure. If stability issues occur after extending the disk of the operating system, engage the operating system vendor accordingly.

Environment

VMware ESXi 4.0.x Installable
VMware ESX Server 3.5.x
VMware ESXi 4.1.x Embedded
VMware ESX 4.0.x
VMware ESX Server 2.5.x
VMware vSphere ESXi 5.0
VMware ESXi 4.0.x Embedded
VMware ESXi 3.5.x Embedded
VMware ESX Server 3.0.x
VMware ESXi 4.1.x Installable
VMware ESX 4.1.x
VMware ESXi 3.5.x Installable

Resolution

To increase the size of the ext3 disk:

  1. Increase the size of the virtual disk associated with the volume from the Virtual Infrastructure Client.
  2. In the Linux virtual machine, reboot to see the larger disk.
  3. Increase the size of the Linux partition to use the new space. If there is a swap and/or extended partition after it, you can unmount swap with:

    # swapoff /dev/sdXY

    This removes the extended partition temporarily. You can do this by going to fdisk /dev/sdX , delete Linux partition (type 83), recreate a new partition larger in size leaving space for the swap partition, and quit.

  4. Reboot the virtual machine again to see the new partition table.
  5. Run this command to increase the filesystem size to use the full partition space:

    # resize2fs /dev/sdXY

    The X indicates the device number. The Y indicates the Linux partition.

  6. Recreate a swap partition, if you originally had one.

    To recreate the swap partition:
    1. Reboot to see the partition table.
    2. Run the commands:

      # mkswap /dev/sdXY
      #
      swapon /dev/sdXY

      Where sdXY is the swap partition.

    3. You might want to change the swap partition entry in /etc/fstab if the device name/number changed.
Note: You can also use the ext2online command which allows you to extend without unmounting. For more information, see http://linux.die.net/man/8/ext2online.

For instructions on increasing the size of a ext3 disk managed by Logical Volume Manager, see Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371).


Additional Information

For information on deleting a partition, see Linux: How to delete a partition with fdisk command.

Note: The preceding link was correct as of March 28, 2013. If you find the link is broken, please provide feedback and a VMware employee will update the link.Extending a logical volume in a virtual machine running Red Hat or Cent OS
Como aumentar o tamanho de um disco ext3 de máquina virtual Linux
Aumento del tamaño de un disco de máquina virtual Linux ext3
增加 Linux ext3 虚拟机磁盘大小
Linux ext3 仮想マシンのディスク サイズを増やす