SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

resizeesxvirtualdisk

Resize ESX Virtual Disk

It's possible to resize disks in a VMware ESX / Infrastructure environment. Increasing is easy, and there's almost no risk on losing data. If you need to make a disk smaller you should always turn the guest off, since there is a serious chance of losing data. To resize disks there are two steps to follow, first resize the actual disk and then you need the guest operating system to recognize the new available disk space.

Disk Resize

There are two ways to resize disks:

Through the Client

  • Open the client in the VMware Console and open the settings
  • Select the disk you're about to resize:

resizeclient.jpg

  • Just make the disk the correct size and click OK.

Through the Commandline

Before you start following this procedure keep these points in mind:

  • Shrinking the volume works on the same way, just add an extra switch --force
    • Note: This is THE way to lose data!
  • This functionality only works with ESX editions prior to 3.


Procedure:

  • Use the just described way to check where in the filesystem the diskfile is located
  • Log on to the ESX server on the commandline and become root
  • Navigate to the diskfile
  • Issue this command to resize the disk:
    • Note: New size is the complete new size, not the size you want to increase or decrease with
vmkfstools -X <new size> <disk name>.vmdk
  • You're done now!

Operating System

Windows and Linux

  • Start the Virtual Machine guest with a Knoppix CD
  • Start in knoppix the tool qtpart
  • Resize the partition
  • Start the OS, and allow it to perform file system checks

Linux Extra

In linux you could also assign the disk to another guest to resize the partition, you can use the normal system tools then. In Suse, that would be: Yast2 → System → Partitioner.

Note

Not so long ago, I tried this procedure on a SLES 10 SP2 box and ran into some problems. I downloaded the latest Knoppix version, 6.2.1 and there was no qtpart application available, on both the CD and the DVD. So eventually, I resized the disk using 'gparted'. When I rebooted the machine I ran into the problem that only the partition was resized and not the file system: Partitioner:

/dev/sdb │     20.0 GB│   │VMware-Virtual disk│       │        │    0│2609│
/dev/sdb1│     19.9 GB│   │Linux native       │/opt   │K       │    0│2609│

This is however what df -h said:

/dev/sdb1             9.9G  4.2G  5.3G  45% /opt

So, I still had to resize the filesystem:

slesbox:~ # resize2fs /dev/sdb1
resize2fs 1.38 (30-Jun-2005)
Please run 'e2fsck -f /dev/sdb1' first.

slesbox:~ # e2fsck -f /dev/sdb1
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 9143/1310720 files (8.1% non-contiguous), 1205470/2620595 blocks

slesbox:~ # resize2fs /dev/sdb1
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/sdb1 to 5241198 (4k) blocks.
The filesystem on /dev/sdb1 is now 5241198 blocks long.

After these steps I could mount the filesystem again and use the new space:

slesbox:~ # mount /opt

slesbox:~ # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1              20G  4.5G   15G  24% /opt
You could leave a comment if you were logged in.
resizeesxvirtualdisk.txt · Last modified: 2021/09/24 00:25 (external edit)