Showing posts with label vmware. Show all posts
Showing posts with label vmware. Show all posts

VmWare: Defrag all your virtual machine disks through command line

Some people are happy to wait for the progress bar in a setup screen to tick to 100%.

Power users would rather create a script that'll do it for them, without locking up VMware (still leaves the disk locked, but you can still run other guest machines).

To run a defrag from CLI:

"%PROGRAMFILES%\VMware\VMware Workstation\vmware-vdiskmanager" -d "X:\Virtual Machines\Windows 7 x64\Windows 7 x64.vmdk"

To defrag ALL of them in one line:

cd path\to\your\vms

for /R .\ %i in (*.vmdk) do "%PROGRAMFILES%\VMware\VMware Workstation\vmware-vdiskmanager" -d "%i"

This scans recursively for any vmdk files and runs the vmware-vdiskmanager command on it.

Sources

VMware: Change boot sequence to load CD

I wanted to try out a copy of ophcrack live CD and realised I had a bit of trouble pressing F2 quick enough to get into the BIOS settings.

It's tricky because it skips that screen so quickly, but you can use the mouse to give focus to the VM and press F2 as quick as possible.

Luckily, we can add an artificial delay so it'll give us humans a fighting chance at changing some BIOS settings for the VM.

  • Go to where you VM files are located.
  • Look for the ".vmx" file.
  • Open it up in notepad.
  • Add (or find) the line which has "bios.bootDelay"
  • Add bios.bootDelay = delay in milliseconds

If you want it to wait 3 seconds, use the value of 3000.

[ Source ]

Windows 7: Cannot view/access/list any other computers on network

On one strange occasion, with proper permissions and firewall settings set, my notebook running Windows 7 (Computer A) cannot display ANY computers on the network except for itself.

The Windows XP machine (Computer B) was correctly displaying the other computers in the network correctly. The other Windows XP machine (Computer C) was also listing everything correctly.

All the computers could ping each other correctly, except Windows Explorer got confused when trying to find them. Typing in the path manually didn't work either.

When trying to access Computer A from Computer B, I was prompted with a password dialog. Strangely enough, even though I typed the correct information it wouldn't let me connect.

image

So what was wrong with Computer A running Windows 7? For some reason, it was connected to both my wireless network and VMWare virtual network.

After doing a little snooping, I discovered that it was the "VMWare DHCP Service" and "VMWare NAT Service" services which were messing with my wireless network settings.

Go into the "Services Manager" (by running "services.msc") and stop the services mentioned above. Don't disable them, only stop.

Refresh the network browser and the other computers should display properly.

Defragging and shrinking VMware drives

Just like a physical hard drive, a virtual hard drive can also be prone to slowdowns after months of usage if care is neglected.

After fixing up a few computers for friends who are not exactly tech-savvy, the speed improvements after a disk defrag is quite surprising. Normally they expect a computer to be formatted after a year of usage.

Use VMware's Disk Defrag:
To help maintain optimal speeds with the virtual drive, a disk defragmentation tool is bundled with VMware.

You can find it in the "Edit Virtual Machine settings" link under the "Hard Disk" item. Click on "Utilities" and then "Defragment".

Shrink your drive:
This will reduce the bloat in your virtual machine, removing unnecessary data such as snapshots. Depending on the usage, I've found it to remove up to 6.5gb on my host computer after cleaning a 20gb virtual drive.

To access this, it requires "VM Tools" to be installed on the guest machine. Run the virtual machine and click on the VM Tools icon in the taskbar.

Go to "Shrink" and select the supported partitions you wish to shrink. Click "Prepare to shrink" and give it some time to work its magic. Once its ready, confirm that you wish to shrink and it'll do some crunching.

*edit 22/02/2010*
It is now much easier to shrink your drives. Just go to edit your VM machine settings, select the HDD and select "Compact" from the "Utilities" dropdown.

image

There are more uncommon space saving tips here.

Fix: VMWare slow to release swapped memory after stopping guest

Ever since upgrading to VMWare v6.5.1, I've noticed it would take several minutes for my laptop to respond to input after closing VMware or pausing/shutting down a guest.

The excessive harddrive activity would halt my host operating system and prevent hibernation from working (causing me to nearly miss my train station several times!)

Luckily, someone's found the solution to fixing this problem by setting some hidden configuration options.

Open up your "guest.vmx" file in Notepad and paste the following lines at the end of the file.
mainMem.useNamedFile = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"
prefvmx.minVmMemPct = "100"
This has stopped the excessive harddrive activity on my laptop and I have been able to get off the train on time =)

[ Source ]

For more configuration options, see this link.

VMware massive harddrive lag after pausing/stopping guest

I've noticed that ever since the upgrade to v6.5.1, my laptop has had trouble hibernating.
It would just halt at "preparing to hibernate" and the disk would keep whirring.

After a bit of experimentation, I've realised that its not because of the hibernation processing screwing up, but the to the excessive harddrive activity after shutting down VMware.

The upgrade changed the way some harddrive options worked for the guest.
While the guest is running, any changes to the hdd would be kept in a "redo log" and processed when a snapshot is taken.

After running a guest for about an hour, this equates to ALOT of backlogged processing which takes a few good minutes to perform. Generally, a few good minutes which I dont have.

Luckily, it is quite easy to disable this feature.

Go to your virtual machine and make sure it is not suspended.
Edit the hard disk settings and go to "Advanced".
Click on "Independant" and ensure that "Persistant" is selected.
Save your settings and all should be well.

[ Source ]
No real instructions provided by the source, but it let me figure out where to look.

Increase hard drive size for VMware disk

1. Open up command prompt.
2. Go to your installation of VMware (ie. "C:\Program Files\VMware\VMware Workstation")
3. Type: vmware-vdiskmanager -x sizeGb "filename"

Example
vmware-vdiskmanager -x 20Gb "K:\Virtual Machines\Kubuntu\vmware-vdiskmanager.exe"
4. Once you're done with that, use some software within the VM to change the partition size.
Linux generally have their own partition software within the setup CD/DVD, whereas Windows would have Acronis Disk Director or Partition Magic.

Personally I'd install Disk Director, because I've lost data on my actual computer before when using Partition Magic. Plus its now a Symantec product, which brings to mind the expression "the cure is worse than the disease".

Either way, the demo would work fine since its a VM.

[ Source ]

*edit 30/03/2009*
I've noticed alot of people getting to this blog in hopes to find a way to stop VM ware from lagging your computer after you suspend a guest.

Google seems to be returning the wrong results as the menu contains a link to the right post.

You can find that post here.
 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog