VMware Cloud Community
bblqk83
Contributor
Contributor

Expanding a Virtual Disk in ESX

I need to expand a Virtual Disk in ESX, I have looked through the book and the VMWARE Site but no luck...

Does anybody know the Command to do this????

Cheers

Reply
0 Kudos
37 Replies
stuten
Enthusiast
Enthusiast

This is what I do as well -- has always worked great.

Reply
0 Kudos
anson9
Contributor
Contributor

I'm having trouble getting vmkfstools to go; how do I know what my SCSI ID that I prepend to my .vmdk should be?

I'm doing a vi3 eval and have my data store on the local SCSI of my ESX server. When I try vmkfstools I keep getting a "Failed to extend the disk : The system cannot find the file specified. (25)". But shouldn't this be correct? :

vmkfstools -X 12G vmhba0:0:0:3:mydrive.vmdk

I'm going by that SCSI ID because that's what I see when I log on to VI Client and go to configuration > storage > properties.

Reply
0 Kudos
stuten
Enthusiast
Enthusiast

Rather than worry about that, just change the working directory to where your vmdk is located and execute the command without the path.

So the command would be vmkfstools -X 12G mydrive.vmdk

give that a try and see if it works. In case you aren't familiar, you can find the vmfs volumes under /vmfs/volumes

Reply
0 Kudos
anson9
Contributor
Contributor

Ok I got it, thanks stuten you put me on the right path.

My issue was that I had previously changed the name of my server in VM, which caused the file structure in Linux to be weird.. there was an appropriately named vmdk flat file in a directory with the new name (still not sure if it is actually in use), but the smaller vmdk file was in a dir with the old name. I can verify the vmdk path as the old name in VI Client at "edit settings > hard disk 1 > disk file".

Reply
0 Kudos
rfugitt
Contributor
Contributor

1. Shutdown the VM

2. At the ESX host command prompt, cd to the folder where the .vmdk resides and type the following command:

vmkfstools -X 230g J1XXX.vmdk

(if you see there is a “–flat” file, don’t try to extend that – just extend the .vmdk file!)

3. Power up the VM

In Windows 2003:

Command Prompt

Diskpart

List disk

Select disk 1 (or whatever disk you are trying to extend)

Select volume 2

Extend

Reply
0 Kudos
smsf
Contributor
Contributor

I just extended one of my drives (after backing up the data of course) and here's my experience:

1) Shutdown the original VM (1st) with the drive needing to be extended.

2) Changed directory to where the vmdk file resides

3) vmkfstools -X 65G J <filename.vmdk> (ignored the -flat file)

4) Added the file to a running VM (2nd)

4) Tried diskpart with the right disk and partition selected but it said the selected partition could not be extended. Exited, checked the drive under Disk Management console and everything was correct. Tried diskpart again and got the same error.

5) Pulled out my MiniPE XT CD and launched Parition Magic within the VM. Didn't work (something about not being able to run it under NT).

6) Launched Paragon Partition Manager. Extended the drive to its full size and applied successfully.

7) Found out I couldn't remove the vmdk file while the system is running so I had to shutdown the running VM (wasn't prepared to do that).

😎 Removed the extended vmdk from the 2nd VM and rebooted it.

9) Boot the 1st VM. It took a while on the first boot and had to scan the newly extended drive for problems but everything worked.

BTW, I had to do this as the WSUS service I'm running on one of my VMs was taking up too much space. I decided to move the WSUS content store to a network drive but found out that it could only be done with an iSCSI initiator (won't work with network share or mapped drive).

Reply
0 Kudos
svaradha
Enthusiast
Enthusiast

Thanks for some nice tips!

I used a former VMware Server vm (Windows virtual disk) and then converted it to an ESX virtual disk and then expanded it. \*phew*

Worked like a charm!

Regards,

Satheesh Varadharajan[/b]

If you found this information useful, please consider awarding points for "Correct" or "Helpful" answers/replies. :) Regards, -Satheesh-
Reply
0 Kudos
russjar
Enthusiast
Enthusiast

Hi,

I have noticed something a bit strange when using vmkfstools to expand a virtual disk. Out of curiosity I created a VM with a 1Gb disk without an operating system. I booted into the VM using a PE disk and checked the size of the volume which was all OK. Then I shutdown the VM and extended the virtual disk to 4Gb. I had a look in the VI client to see if the change was reflected in the GUI, which it wasn't. The VM settings for that disk were still showing 1Gb. I booted into the PE disk again and had a look at the disk properties and the change was showing that the extension had been successful. I created a partition, formatted the disk and shutdown, re-checked the VI client but it's still showing a 1Gb disk, using putty or similar the byte size is correct.

Is this normal behavior, what's going on..?

Cheers

VCP,MCSE NT4/W2k/W2k3, MCSA W2k3
Reply
0 Kudos
xavier_rustom
Contributor
Contributor

Russjar,

Unfortunately, for ESX 3.0x, this is normal. In the VI GUI (VM properties), you usually just have to wait... it will eventually be automatically updated. From the "size taken on disk" perspective, either in VI Client or CLI, when you expand a drive with the standard "vmkfstools -X" it will be expanded in "thin" mode: the new size will not be reserved or used on the VMFS datastore. You may convert the "thin" disk mode to "thick" using "vmkfstools -j"... but it could take a lot of time. If you have enough disk space, use the clone option ("vmkfstools -i"), or create a new virtual disk using VI and ghost the old disk to this one...

Hope this helps,

Xavier.

Reply
0 Kudos
russjar
Enthusiast
Enthusiast

that's a great explanation, thankyou...

VCP,MCSE NT4/W2k/W2k3, MCSA W2k3
Reply
0 Kudos
zedekiah
Contributor
Contributor

I used the infrastructure client to give the hard disk 1 (virtual disk) more space. I click o.k. but it never actually allocates the new size. What gives? The ESX is a linux box. The person who usually handles this transferred out of our group. Do I need to use the vmfstools or would I get the same result going that?

Thanks

Reply
0 Kudos
Kevin_Hamilton
Contributor
Contributor

If I understand what you are trying to achieve, I think you will need to go into the guest VM if it is a windows box and use Diskpart to extend the disk.

Scenario example in my head is as follows:

Need to increase D Drive on a Windows VM from 40Gb to 60Gb. Close down VM in VI CLient then edit the VM and increase the disk from 40Gb to 60 Gb.

Start up the VM then goto Computer Management and maybe run a rescan disks, you will see the spare 20Gb partition at the end of D Drive. Use Diskpart to extend the disk and done. If you need info on using Diskpart and I will put a link in.

Not sure if this covers exactly what you need if not give a bit more info.

The following link is a very good guide if you needed to do the boot partition. It has all the info you need if you still need to use vmkfstools if you are not running the latest VC versions.

http://vmprofessional.com/index.php?content=2k3resize

Cheers

H

Reply
0 Kudos
NBolton2009
Contributor
Contributor

I hate to bring up an old thread, but while I've been successful in expanding the Virtual Disk I cannot expand the partition using Gparted, or DiskPart. Gparted doesn't report back the virtual disk at all. I'm somewhat new to all this so any assistance would be greatly appreciated.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Try out dell's extpart... its what I'm using for my windows VMs

http://support.dell.com/support/downloads/download.aspx?c=us&cs=19&l=en&s=dhs&releaseid=R64398&forma...

http://www.rtfm-ed.co.uk/?p=1310

Regards

Mike Laverick

RTFM Education

http://www.rtfm-ed.co.uk

Author of the SRM Book: http://www.lulu.com/content/4343147

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
njd62495
Contributor
Contributor

Download and install Symantecs Storage Foundations (it's free!!!)

Go to Edit Settings, give the vm's Hard Disk its new size

Logon to the server, fire up SF and extend the disk (can be done with basic or dynamic)

Best part of SF...NO REBOOT NEEDED!!!!

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Even quicker is Dell's extpart utility - and its free and doesn't have hetfy installer...

Regards

Mike Laverick

RTFM Education

http://www.rtfm-ed.co.uk

Author of the SRM Book:http://stores.lulu.com/rtfm

Free PDF or at-cost Hard Copy

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos
njd62495
Contributor
Contributor

SF is a bit bulky.

Thanks for the tip on the Dell extpart...didnt know about that one.

Oh, and by the way...love the site, I refer to it often.

Reply
0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

Cheers. I luv extpart one of the best and simplest things I've come across this year.

Thanks a lot!

Regards

Mike Laverick

RTFM Education

http://www.rtfm-ed.co.uk

Author of the SRM Book:http://stores.lulu.com/rtfm

Free PDF or at-cost Hard Copy

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
Reply
0 Kudos