VMware Cloud Community
olegarr
Enthusiast
Enthusiast
Jump to solution

Shrinking Virtual disk with SDELETE tool error

Hello:

I am trying to shrink virtual disk by using SDELETE tools. I read a lot of positive feedbacks about SDELETE tools and looks like it should be very easy to use. However, it’s not working for me.

When I am using SDELETE tool my VM and Datastore, where VM located, run out of space and VM crashed.

I found that during the process SDELETE using temp file SDELTEMP and it growing very-very fast. On Datastore I can see, that when I started SDELETE tool new virtual disk appeared: Vmname-delta.vmdk which is taking a lot of space as well (my DATASTORE will run out of space very fast).

I am running just simple command: sdelete.exe -p 1 -c DriveLetterWithColon .

Can someone, PLEASE, explain me, what is causing my issue, and how can I avoid it?

I really need to be able to shrink virtual disk.

Thank you,

olegarr

0 Kudos
1 Solution

Accepted Solutions
esiebert7625
Immortal
Immortal
Jump to solution

Well you can use Converter in Hot mode to clone a VM and shrink the disk while the VM it running. I would not do this on a AD/Exchange/Database server though.

View solution in original post

0 Kudos
7 Replies
RDPetruska
Leadership
Leadership
Jump to solution

Well, what sdelete does is create a wiper-file and fill the drive's space with zeros. Afterwards, the zeroed space can be shrunk. Of course, this assumes you have a growable disk. If you have a preallocated disk, it really makes no sense at all to do this.

esiebert7625
Immortal
Immortal
Jump to solution

Some of these methods should work for you, if you find this post helpful, please award points using the Helpful/Correct buttons...thanks

How can I resize my VM’s hard disks?

There are several methods to do this that are listed below. If you want to shrink the disk in ESX3 then using Vmware Converter is the best way to do this, you can also try using QpartEd to shrink a disk. You can no longer use vmkfstools to shrink a disk in ESX3. With all these methods you should make a backup copy of your original vmdk file in case something goes wrong. Also make sure you shutdown the OS cleanly before restarting the VM (GpartEd will sometimes fail otherwise). Methods 1, 4 & 5 are essentially the same using Linux boot CD’s and either GpartEd or QpartEd.

Method 1 – Using vmkfstools and gparted (http://gparted.sourceforge.net/livecd.php) to extend a disk

o Download the gparted livecd ISO and make it available so it can be mounted by the virtual machine’s CD-ROM

o Shutdown the virtual machine you want to resize

o Log into the ESX Server console via Putty

o Type “vmkfstools –X ” ie. /vmfs/volumes/Storage1/my_vm.vmdk New disk size can be specified in kilo, mega or gigabytes and will be the total size of the new disk. So if you want to increase a virtual disk from 20GB to 24GB you would specify either 24000m or 24g

o Power on the Virtual Machine and make sure it boots properly, load Disk Management and you will see the new unallocated space

o Now to join the unallocated space to the primary partition, first shutdown the Virtual Machine

o Connect the Virtual Machine to the System Rescue ISO file and make sure you enable Connected at Power On

o Power on the Virtual Machine

o Press ESC at the Bios screen to get to the Boot Menu

o Select CD-ROM as the Boot device

o Press Enter at the boot screen

o Press Enter after boot sequence is complete and then type ‘startx’

o Once X-windows loads, double-click the GpartEd icon (drive icon, 3rd down on the right hand side)

o Once the partition editor loads, click on /dev/sda1 in the partition list

o Click the Resize/Move button

o Click and drag the arrow to extend the size of the partition, make sure you do a resize (double arrow) and not a move (four way arrow) so you should 0 free space preceding and following and then click the Resize/Move button

o Next click the Apply button and then the operation will start, you can expand Details to see the progress, once completed click the Close button.

o Click the power button in the bottom right corner, then select reboot.

o Edit the VM and remove the ISO from the CD/ROM device (change to Client)

o When the server restarts it will do a Check Disk, let this complete, Windows will prompt for a reboot after you login

o Reboot and load Disk Management and your Primary Partion will be the new size without any unallocated space

Method 5 - Using Knoppix Live CD with QtPartEd- (http://www.knoppix.org/) to shrink a disk

o Download the Knoppix Live CD and make it available so it can be mounted by the virtual machine’s CD-ROM

o Shutdown the virtual machine you want to resize

o Add a second virtual disk of the new smaller desired size to the VM you want to resize

o Connect the Virtual Machine to the Knoppix Live CD ISO file and make sure you enable Connected at Power On

o Power on the Virtual Machine

o Press ESC at the Bios screen to get to the Boot Menu

o Select CD-ROM as the Boot device

o Press Enter at the boot screen

o Click on the K Menu icon and then select System and then QTPartEd

o Select your original drive (usually sda) and click on the partition 1

o Select Operations from the top menu and then Resize, resize the drive so it is just less then the new drives (sdb) capacity

o Select File from the top menu and then Commit, click Yes at the warning window

o Once complete, select Cancel if you get a unmounted hard disk window and then OK at the Progress window.

o Open a Konsole window and type “dd if=/dev/sda of=/dev/sdb” This copy will take a long time and will not show a status while it is running. Yyou will get an insufficient space error at the end of the copy, this is normal because the drive you’re copying from is bigger then the destination. But as long as the partition is smaller, everything will work.

o Shutdown the VM and edit the VM settings, remove the original C: drive and change the SCSI ID of the new drive to match the old one (usually 0:0)

o Power on the VM and it will run a Chkdsk and you will be all set

Method 6 – Use Ghost or another 3rd party imaging product to shrink a disk

o Shutdown the virtual machine you want to resize

o Add a second virtual disk of the new smaller desired size to the VM you want to resize

o Use Ghost to clone the first disks partition to your second virtual disk.

o Once complete make sure the second virtual disk is ‘Active’

o Switch your disks by editing the virtual machine settings and switching the SCSI id’s (0:0 and 0:1)

o If the virtual machine boots OK and you verify that everything works then shutdown the VM and remove the larger disk and delete it

olegarr
Enthusiast
Enthusiast
Jump to solution

Thank you very much for your help.

But, is there a way to do shrink virtual disk when the VM is still running??? I am talking about heavy used production machine which I do not want to shut down...

the problem is that if I will back it up by using esxRanger before Shrink the Virtual file, I'll have HUGE backup file, even there is not too much space in use...

Again, is there a way to do shrink virtual disk when the VM is still running?

many thanks,

olegarr

0 Kudos
esiebert7625
Immortal
Immortal
Jump to solution

Well you can use Converter in Hot mode to clone a VM and shrink the disk while the VM it running. I would not do this on a AD/Exchange/Database server though.

0 Kudos
olegarr
Enthusiast
Enthusiast
Jump to solution

Thank you very much for your help.

Good luck.

olegarr

0 Kudos
GBromage
Expert
Expert
Jump to solution

If you have a preallocated

disk, it really makes no sense at all to do this.

Unless you're using VCB to do your backups, or are otherwise compressing the vmdk file. If you're doing either of these, it makes a lot of sense.

I hope this information helps you. If it does, please consider awarding points with the 'Helpful' or 'Correct' buttons. If it doesn't help you, please ask for clarification!
0 Kudos
Dracul
Contributor
Contributor
Jump to solution

Hi olegarr

it seems there were an active snapshoot.

If you change a filesystem with an snapshoot all changes will be written in delta-Files. (if You clean ut to 200GB this File will brot up to 200GB aditional space.

clear the snapshoot and all should be ok

Dracul

0 Kudos