Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 19, 2013, 09:50:59 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Making a zone a fixed size  (Read 518 times)
MonarchDodra
Newbie
*
Posts: 3


View Profile
« on: December 02, 2011, 11:48:09 am »

I have a particular usecase: I have a folder on a development disc that regularly grows or shrinks anywhere from 1GB to 35GB. Because of this, I want to allocate it to a fixed-size 40 GB zone near the beginning of the disc, so as to avoid its size change impacting the other zones.

I cannot, for the life of me, get it to work. I can add a gap after the end all I want, but I can't seem to get the entire zone a fixed size.

This is my code:

Code:
  FileSelect
    DirectoryPath("...")
  FileActions
    SortByName(Ascending)
    AddGap(ZoneBegin + 40Gi)
  FileEnd

As you can see, I tried to use AddGap with ZoneBegin, rather than ZoneEnd, but it doesn't work. All this code does is create a gap after my zone that is 20Gi big.

Any help?  Huh

I also tried toying around with variables, but they appear to be re-evaluated from their expression every time they are used, making it impossible to extract the "ZoneBegin" of a given spot.  Sad
« Last Edit: December 02, 2011, 01:43:45 pm by MonarchDodra » Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #1 on: December 02, 2011, 05:47:19 pm »

There is bug with AddGap that makes it impossible to use some variables correctly, see this post for further info.

What you can do is the following:
Code:
  FileSelect
    DirectoryPath("...")
  FileActions
    SetVariable(ZoneBeginVar, ZoneBegin)
    SortByName(Ascending)
    AddGap(ZoneBeginVar + 40Gi)
  FileEnd
Logged

Need help creating a script? Try MyDefrag Script Creator.
MonarchDodra
Newbie
*
Posts: 3


View Profile
« Reply #2 on: December 02, 2011, 10:44:18 pm »

Thanks a lot for your reply.

I had stumbled upon that thread after posing, and started looking for a workaround.

I had also tried the very code you posted, but it didn't work either. It would appear the variables are re-evaluated from their expression every time they are used, so the "wrong" ZoneBegin is used when ZoneBeginVar is re-evaluated inside the AddGap function  Embarrassed The debug info shows it too.

I ended up fixing my problem by simply using absolute sizes calculated by hand. While I would have wished to tweak my script as much as possible, to make it generic and distributable to my co-workers ( being the geek that I am), I'm already more than thrilled and incredibly happy with what MyDefrag has done for me.
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #3 on: December 03, 2011, 07:18:44 am »

According to the debug log, this one should work correctly:
Code:
 
  SetVariable(ZoneBeginVar, ZoneBegin)

  FileSelect
    DirectoryPath("...")
  FileActions
    SortByName(Ascending)
  FileEnd

  MakeGap(ZoneBeginVar + 40Gi)
Logged

Need help creating a script? Try MyDefrag Script Creator.
ff_mfg
JkDefrag Hero
*****
Posts: 51


View Profile
« Reply #4 on: December 05, 2011, 09:36:58 am »

I've used
    AddGap(RoundUp(ZoneEnd,50GB))
for similar reasons.
The obvious downside is that disk layout will be screwed up if the zone gets larger than 50GB.
Logged
MonarchDodra
Newbie
*
Posts: 3


View Profile
« Reply #5 on: December 05, 2011, 09:59:27 am »

Hey, thanx,

I like the RoundUp approach:
The truth is that I have several of these varying size folders on my drive. So do my colleagues. This "Align each folder on a 20 GB alignment" thing will work great to handle everyone in a generic fashion!
Logged
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!