Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 24, 2013, 12:36:34 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: Need help with music disk script (Solved, or at least worked around)  (Read 677 times)
woodfold
JkDefrag Senior
****
Posts: 31


View Profile
« on: March 09, 2012, 09:37:05 pm »

I'm trying to make a script based on the data disk daily script. It's supposed to do the usual fragmenting of the first 2 zones, then I'd like all MP3s in the 3rd zone (no particular order), a gap, the archives I haven't processed yet in zone 4, a gap, and then any other files in the 5th zone.

Here's the script:
Code:
# MyDefrag v4.0 Test script: Music Disk Daily
#
# This script is part of the standard MyDefrag distribution.

Title('Music Disk Daily')
Description("Music Disk Daily description")   // See the "Settings.MyD" file.

Slowdown(100)

/* Write the header to the logfile. See the "Settings.MyD" file for the
   definition of the "LogHeader" string. */
WriteLogfile("!ScriptTitle!.log","LogHeader")

ExcludeVolumes(CDRom(yes) or not(CommandlineVolumes()) or Label("SYSTEM RESERVED")or Name("C:") or Name("H:"))

/* Select and process the volumes one by one. */
VolumeSelect
  CommandlineVolumes()
VolumeActions
  SetFileColor(FileName("*.mp3"),All,99,130,191)

  /* Write the "before" statistics to the logfile. See the "Settings.MyD" file
     for the definition of the "LogBefore" string. */
  AppendLogfile("!ScriptTitle!.log","LogBefore")

  /* Zone 1: Place the MFT and some other special NTFS files. */
  FileSelect
    SelectNtfsSystemFiles(yes)
  FileActions
    PlaceNtfsSystemFiles(Ascending,MftSize * 0.01)
  FileEnd

  /* Zone 2: Directories. */
  FileSelect
    Directory(yes)
  FileActions
    SortByName(Ascending)
    AddGap(ZoneEnd + VolumeSize * 0.01)
  FileEnd

  /* Zone 3: MP3 files. */
  FileSelect
    FileName("*.mp3")
  FileActions
    Defragment()
    FastFill(WithShuffling)
    AddGap(ZoneEnd + VolumeSize * 0.01)
  FileEnd

  /* Zone 4: Archives. */
  FileSelect
    (FileName("*.rar")
    or FileName("*.part*.rar")
    or FileName("*.zip"))
  FileActions
    Defragment()
    MoveUpToZone()
    FastFill()
    AddGap(ZoneEnd + VolumeSize * 0.01)
  FileEnd

  /* Zone 5: all other files. */
  FileSelect
    all
  FileActions
    MaxRunTime(300)
    Defragment(Fast)
    MoveUpToZone()
    FastFill()
  FileEnd

  /* Write the "after" statistics to the logfile. See the "Settings.MyD" file
     for the definition of the "LogAfter" string. */
  AppendLogfile("!ScriptTitle!.log","LogAfter")
  Pause(5)

  ReclaimNtfsReservedAreas()

VolumeEnd

/* Write the footer to the logfile. See the "Settings.MyD" file for the
   definition of the "LogFooter" string. */
AppendLogfile("!ScriptTitle!.log","LogFooter")

Here's my problems:
  • Some ZIP files are remaining in the MP3 zone, instead of moving up to the next zone. Why?
  • Why aren't the gaps preserved but are filled in?

I don't want the files sorted, because they will added to pretty regularly and I just want them separated.

Can't anyone fix this, or tell me where I went wrong?
« Last Edit: March 11, 2012, 02:52:55 am by woodfold » Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #1 on: March 10, 2012, 02:52:12 pm »

Your script looks fine to me. The only reason I can think as to why the zip files aren't moved up is because they're locked by another program (Antivirus perhaps?).

MyDefrag doesn't remember the gaps it has created. If you zones grow (or shrink) then the gaps made in the previous run will be filled. You can reduce the zone shifting by using RoundDown and RoundUp or giving the zones a fixed location.

I have some optimizations suggestions for you script:
- Your ExcludeVolumes statement is quite complex. Why don't you directly select the volume(s) you want to process?
- MoveUpZone() is not necessary since you're vacating the gaps. Either remove these statements or DoNotVacate the gaps.
- FileName("*.part*.rar") is unnecessary because these files will already be selected by FileName("*.rar").
- I don't know if ReclaimNtfsReservedAreas() will move already processed files. You should place it as the first volume action.
Logged

Need help creating a script? Try MyDefrag Script Creator.
woodfold
JkDefrag Senior
****
Posts: 31


View Profile
« Reply #2 on: March 10, 2012, 06:36:17 pm »

Thank you for your suggestions. I'm going to make those mods and let it run.
Logged
woodfold
JkDefrag Senior
****
Posts: 31


View Profile
« Reply #3 on: March 10, 2012, 09:41:22 pm »

I made these changes and on the first pass all MP3s moved to their zone, all archives to theirs, etc.

After adding new MP3s to the disk, I re-ran it and while the MP3s seemed to be defragged, they were not moved to the 3rd zone with the rest of the MP3s, but basically remained wherever they were, mingled with the 4th zone files, but defragged.

Did I do something wrong?
 
Code:
  /* Zone 3: MP3 files. */
  FileSelect
    FileName("*.mp3")
  FileActions
    Defragment()
    FastFill(WithShuffling)
    AddGap(RoundUp(ZoneEnd + ZoneSize * 0.1 , VolumeSize * 0.01))
  FileEnd

  /* Zone 4: Archives. */
  FileSelect
    (FileName("*.rar")
    or FileName("*.zip"))
  FileActions
    Defragment()
    FastFill(WithShuffling)
    AddGap(RoundUp(ZoneEnd + ZoneSize * 0.1 , VolumeSize * 0.01))
  FileEnd

  /* Zone 5: all other files. */
  FileSelect
    all
  FileActions
    Defragment(Fast)
    Defragment()
  FileEnd
Logged
Darlis
JkDefrag Hero
*****
Posts: 1707


View Profile WWW
« Reply #4 on: March 10, 2012, 10:21:17 pm »

The script looks fine. Is there enough free space to move the files around?
If the files aren't moved to their zones on the second run you can create a debug log file to see what's going on ([FAQ]I have a problem!).
Place the Debug(175) just before the zone 3 file select.
Logged

Need help creating a script? Try MyDefrag Script Creator.
woodfold
JkDefrag Senior
****
Posts: 31


View Profile
« Reply #5 on: March 11, 2012, 12:53:50 am »

There are 107GB free out of 625GB.

Here's the log, I stopped it after it went on to Zone 4.

I just realized there is a pagefile at the beginning of this particular drive. Is this causing the problem? Can I start zone 3 just after the pagefile? Can we figure out how big a gap I would need from the log?

I'm running the script on a drive that doesn't have a pagefile on it. I'll see how it does, add some mp3s and run it again.

UPDATE: I ran it on I: (no pagefile), added 600 mp3s and reran and it worked fine. It really looks like having a great honkin' pagefile is screwing MyDefrag up. I'm going to try some experiments on increasing the gap after Zone 2.

* MyDefrag.debuglog (33.04 KB - downloaded 36 times.)
« Last Edit: March 11, 2012, 01:51:22 am by woodfold » Logged
woodfold
JkDefrag Senior
****
Posts: 31


View Profile
« Reply #6 on: March 11, 2012, 02:52:07 am »

Final version uses a MakeGap and works fine. There is a fairly large gap (~10MB) at the beginning of the disk, but I consider that a "work area".   Smiley

As to why the immovable pagefile causes this problem, I'll leave this up to Jeroen.

Code:
  /* Zone 2: Directories. */
  FileSelect
    Directory(yes)
  FileActions
    SortByName(Ascending)
  FileEnd

#  MakeGap(RoundUp(ZoneBegin,VolumeFree * 0.03))
  MakeGap(ZoneEnd + 10500 MB)

  /* Zone 3: MP3 files. */
  FileSelect
    FileName("*.mp3")
  FileActions
    Defragment()
    FastFill(WithShuffling)
    AddGap(RoundUp(ZoneEnd + ZoneSize * 0.1, VolumeSize * 0.01))
  FileEnd
  Pause(5)

  /* Zone 4: Archives. */
  FileSelect
    (FileName("*.rar")
    or FileName("*.zip"))
  FileActions
    Defragment()
    FastFill(WithShuffling)
    AddGap(RoundUp(ZoneEnd + ZoneSize * 0.1, VolumeSize * 0.01))
  FileEnd
  Pause(5)

  /* Zone 5: all other files. */
  FileSelect
    all
  FileActions
    Defragment(Fast)
    Defragment()
  FileEnd
  Pause(5)
Logged
BloodySword
JkDefrag Hero
*****
Posts: 1113



View Profile
« Reply #7 on: March 13, 2012, 02:48:30 pm »

My best advise to those who want to optimize pure music disks:

In following scenario, you don't need to optimize or defrag the drive or partition at all:

- You copy files to it / no downloads, only coping (it creates contiguous files)
- You don't delete files, else if you do it, you do very seldom
- You do not update tags frequently

In following scenario, only defragmenting script is useful:

- You copy files to it / no downloads, only coping (it creates contiguous files)
- You delete files seldom or very often
- You are updating tags very often

A full optimize is not recommended especially on 2,5 Inch Notebook or 2,5 Inch NAS/External Travel-Drives, because these could be worn out very fast.

Reson for this: Playback does not need to be defragmentet because the bandwith on playback is way small, that any drive can take it more than 4 times of realtime even if a files is spread all over the disk/partition in 512 byte cluster parts.

Also I recommend, if you only use small bandwith files (mp3, aac, ogg, etc, not flac or wave) to use 2 sectors per cluster (1024 byte) instead of 8 sectors per cluster. This will decrease overhead and more free space can be used.
« Last Edit: March 13, 2012, 02:55:12 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!