Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 23, 2013, 03:25:53 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Script for VMware directories  (Read 3017 times)
jdoll42
Newbie
*
Posts: 2


View Profile
« on: October 27, 2009, 04:09:27 pm »

I've got a bunch of VMware files on a separate disk.  I'd like to defragment the disk, leaving a decent size gap (5-10% disk size maybe?) after each of the virtual disk files (*.vmdk) to accomodate future growth.  Otherwise, as soon as one of the virtual machines is booted, the disk file would almost instantly be fragmented again.

ie:  File1.vmdk...(empty space)...File2.vmdk...(empty space)...File3.vmdk...(empty space)

How would one accomplish this with a MyDefrag script?

Thanks!
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: October 27, 2009, 05:13:59 pm »

Sadly enough Windows will not (always) use empty space behind a file if it needs to grow that file. So MyDefrag does not have any setting to leave free space behind a file. Your best bet is to change the virtual disks into a fixed size.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #2 on: October 27, 2009, 05:43:10 pm »

If you want a gap after a file, you have to do this by hand for every file:
Code:
VolumeSelect
  ...
VolumeActions
  FileSelect
    Name("File1.vdmk")
  FileActions
    SortByName(Ascending)
    # Make a gap of at least 5% and put the next file at a fixed position
    AddGap(PercentageOfVolume(5) UntilPercentageOfVolumeMultiple(5))
  FileEnd

  FileSelect
    Name("File2.vdmk")
  FileActions
   ...

VolumeEnd
Otherwise, the DefragmentOnly script should leave some gaps after the files, with minimum file-movement.
The best solution would be, as Jeroen already mentioned, to give the virtual disks a fixed size. This should also improve performance.
Logged

Need help creating a script? Try MyDefrag Script Creator.
jdoll42
Newbie
*
Posts: 2


View Profile
« Reply #3 on: October 27, 2009, 05:53:03 pm »

Thanks for the quick replies.  I think going to a fixed sized will be my best solution now that I have the disk space to do so.  You've gotta love how Windows expands files.   Grin
Logged
thedave
JkDefrag Junior
**
Posts: 5



View Profile WWW
« Reply #4 on: January 06, 2010, 01:09:58 am »

Sadly enough Windows will not (always) use empty space behind a file if it needs to grow that file. So MyDefrag does not have any setting to leave free space behind a file. Your best bet is to change the virtual disks into a fixed size.

It occurs to me that even if Windows doesn't use conveniently located available free space, leaving this free space now will make future defragmentations more efficient since MyDefrag could use this space.

With this in mind, would it be worth the hassle trying?
Logged
Kasuha
JkDefrag Hero
*****
Posts: 595


View Profile
« Reply #5 on: January 06, 2010, 09:46:11 am »

this free space now will make future defragmentations more efficient since MyDefrag could use this space.
Maybe in future versions of MyDefrag.
Logged
sag47
JkDefrag Junior
**
Posts: 6


View Profile
« Reply #6 on: January 07, 2010, 01:10:21 am »

Not just a fixed size, but also preallocate the space (a setting in VMWare when you create the virtual machines).
Logged
thedave
JkDefrag Junior
**
Posts: 5



View Profile WWW
« Reply #7 on: January 19, 2010, 12:32:09 am »

Not just a fixed size, but also preallocate the space (a setting in VMWare when you create the virtual machines).
In my case, I'm using snapshots, this completely defeats any benefits of using preallocated fixed size disks.
Logged
thedave
JkDefrag Junior
**
Posts: 5



View Profile WWW
« Reply #8 on: January 19, 2010, 12:36:39 am »

this free space now will make future defragmentations more efficient since MyDefrag could use this space.
Maybe in future versions of MyDefrag.

I don't think this needs any real changes in MyDefrag...

I'm spacing out VMWare images by placing them in separate zones, meaning that even when files grow out of their "zone", they can be easily relocated by MyDefrag, meaning that even when a bit of fragmentation happens within a set of VM files, the physical heads aren't moving from one end of the drive to the other constantly.

In a bit of testing it seems to be working, bringing up snapshots is happening in roughly half the time it did before and a full pass of MyDefrag only takes about 15 minutes each night, so I think this is better than compacting everything together.

Logged
Acecape
Newbie
*
Posts: 1


View Profile
« Reply #9 on: June 30, 2010, 09:02:01 am »

What do you think why my vmware doesn't run in my MAC OS? However, it does really work in windows. I think the problem is that the vmware isn't compatible with my OS.
« Last Edit: July 01, 2010, 04:21:35 am by Acecape » Logged

BloodySword
JkDefrag Hero
*****
Posts: 1113



View Profile
« Reply #10 on: July 01, 2010, 08:07:48 am »

Look at my script. It is intended for a partition with VM-Files and regular files. The VM-Directory structure must be in a directory named "Virtual Machines" but you can change it in the scripts. ".snapshots" is intended for zipped VM directories as "snapshots" from a VM with VM-Ware Player wich doesn't support snapshots. It is a weekly script. If you like, remove the "WithShuffling" inside the FastFill brackets, it will be a daily one Smiley. MoveUpToZone() provides assurance that the files will get in their zones.

Title('VM-Disk optimization')
Description("This script optimizes a disk with Virtual Machines")

VolumeSelect
   CommandlineVolumes()
VolumeActions
   #Zone 1 - NTFS-Files
   FileSelect
      SelectNtfsSystemFiles(yes)
   FileActions
      PlaceNtfsSystemFiles(Ascending,MftSize * 0.01)
   FileEnd

   # Zone 2 - Directories
   FileSelect
      Directory(yes)
   FileActions
      SortByName(Ascending)
   FileEnd

   # Zone 3 - VM-Files + 1GiB-GAP
   FileSelect
      DirectoryName("Virtual Machines") and not (DirectoryName(".snapshots"))
   FileActions
      Defragment(Fast)
      Defragment()
      MoveUpToZone()
      FastFill(WithShuffling)
      AddGap(ZoneEnd + 1Gi) #Constant 1 GByte gap after VMWare Files for the files to grow
   FileEnd

   # Zone 4 - Snapshots of VM's + System Volume Information
   FileSelect
      DirectoryName(".snapshots") or
      DirectoryName("System Volume Information")
   FileActions
      MoveToEndOfDisk()
   FileEnd

   #Zone 5 - Rest
   FileSelect
      all
   FileActions
      Defragment(Fast)
      Defragment()
      MoveUpToZone()
      FastFill(WithShuffling)
   FileEnd
VolumeEnd
« Last Edit: July 01, 2010, 12:12:35 pm by BloodySword » Logged

Greetings from Germany!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!