book
Article ID: 307884
calendar_today
Updated On:
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:
-
Increase the size of the virtual disk associated with the volume from the Virtual Infrastructure Client.
-
In the Linux virtual machine, reboot to see the larger disk.
-
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.
-
Reboot the virtual machine again to see the new partition table.
-
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.
-
Recreate a swap partition, if you originally had one.
To recreate the swap partition:
-
Reboot to see the partition table.
-
Run the commands:
# mkswap /dev/sdXY
# swapon /dev/sdXY
Where sdXY is the swap partition.
-
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.