When does OSX defrag?

slipper

macrumors 68000
Original poster
Nov 19, 2003
1,542
32
I know OSX self defrags organizes files, but when does it do it? Is it after i install a program when it 'optimizes'?
 

grapes911

Moderator emeritus
Jul 28, 2003
6,995
3
Citizens Bank Park
I'd guess that the optimization is defraging. But, when ever you access a file OS X 'defrags' that file before using it. This only works the file is under 20mb. I think there is some defraging during the daily, weekly, and monthly scripts too.
 

daveL

macrumors 68020
Jun 18, 2003
2,425
0
Montana
slipper said:
I know OSX self defrags organizes files, but when does it do it? Is it after i install a program when it 'optimizes'?
The "optimizing" installation step is pre-binding the installed program(s); it has nothing to do with defragmenting. The defrag is done on the fly for all files that are smaller than 30 meg (I believe that's the size, but I may be off).
 

GeeYouEye

macrumors 68000
Dec 9, 2001
1,652
6
State of Denial
20 MB is the size limit for auto-defragging. There's also hotfile clustering, which moves oft-used files to nearby regions on the disk. Other than that, the only reason to defrag (and yes, you do have to use a 3rd party utility, though with some clever scripters, this should change in Tiger) is if you're converting a hard drive from general use to video storage for editing, especially if it's a slow drive with lots of previous use of files just greater than 20 MB in size. Generally though, defragging simply isn't needed.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,777
12
Grand Rapids, MI, USA
daveL said:
The "optimizing" installation step is pre-binding the installed program(s); it has nothing to do with defragmenting. The defrag is done on the fly for all files that are smaller than 30 meg (I believe that's the size, but I may be off).
I knew the first part of this, but I have a question...normally, when you force update all prebindings, you must reboot because system performance will be impaired if you do not. I guess this is because prebindings involving almost everything are updated. But when you install new software and it goes through the optimize routine, it does not always require you to restart. So in the cases where it says its optimizing, but it doesn't require you to reboot, is it still doing prebinding when it says its optimizing?
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,777
12
Grand Rapids, MI, USA
GeeYouEye said:
Generally though, defragging simply isn't needed.
So, semi-OT, this is related to the fact that the HD is journalized, correct? That is, non-journalized MacOS partitions in older versions of OS X are not de-fragmented automatically?

What I've been wondering is, NTFS is also journalized, to my knowledge. But MS has been making a big deal about auto-de-fragmentation in Longhorn. So does XP really not have this feature already?
 

daveL

macrumors 68020
Jun 18, 2003
2,425
0
Montana
mkrishnan

1. When you run pre-binding on the entire system, you are affecting system programs, thus the need to reboot. An app installation isn't, in general, touching any OS/System stuff, and if it does, then you will be asked to reboot, e.g. security updates.

2. No, it has nothing to do with journaling, per se. Journaling simply logs meta data changes to the file system so they can be replayed, if needed (a dirty shutdown, for instance). The defrag stuff was added in Panther, I believe, and although it came at the same time as journaling, they are two different features of HFS+.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,777
12
Grand Rapids, MI, USA
daveL said:
2. No, it has nothing to do with journaling, per se. Journaling simply logs meta data changes to the file system so they can be replayed, if needed (a dirty shutdown, for instance). The defrag stuff was added in Panther, I believe, and although it came at the same time as journaling, they are two different features of HFS+.
Ahhh... Thanks! :) I thought that the journal's meta-data was the thing being used to know what to move around and fix for de-fragmentation. At least with hot clustering, that's what some other sites seemed to imply. Anyway, it's good to have it, at least on my Mac. ;) Not that WinFS doesn't sound impressive, should it ever be released....
 

daveL

macrumors 68020
Jun 18, 2003
2,425
0
Montana
mkrishnan said:
Ahhh... Thanks! :) I thought that the journal's meta-data was the thing being used to know what to move around and fix for de-fragmentation. At least with hot clustering, that's what some other sites seemed to imply. Anyway, it's good to have it, at least on my Mac. ;) Not that WinFS doesn't sound impressive, should it ever be released....
The defrag may use the journal's meta data. I just wanted to make it clear that they are two different functions, i.e. you could have a journaled filesystem, but not have the defrag feature or vice versa.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,777
12
Grand Rapids, MI, USA
daveL said:
The defrag may use the journal's meta data. I just wanted to make it clear that they are two different functions, i.e. you could have a journaled filesystem, but not have the defrag feature or vice versa.
Got it... which would explain NTFS on NT4 Win2k and XP, I guess....I do *not* miss defragging. Stupid #$#@ thing restarting because some mouse movement or TSR caused a system file to be accessed. :D
 

stcanard

macrumors 65816
Oct 19, 2003
1,490
0
Vancouver
mkrishnan said:
Got it... which would explain NTFS on NT4 Win2k and XP, I guess....I do *not* miss defragging. Stupid #$#@ thing restarting because some mouse movement or TSR caused a system file to be accessed. :D
The difference between the windows based filesystems which require constant defragging, and the HFS+ or EXT2/3 filesystems that don't is based on the algorithm used to determine the best place (physically) on a disk to place the file. There are many different ways of doing this (do you pick the smallest space that can fit the file, do you pick the largest contiguous block of free space? What do you do with really small files, etc), plus ways of optimizing during cleanup routines.

I had a Windows 2000 system where the defrag kept stopping because defrag had changed a file! I don't miss that...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.