Defragmenting Mac OSX

Table 2: Internal Fragmentation

iBookPB15PB17G5G5 ExtBlock Size4 KB4 KB4 KB4 KB4 KBData Forks3.72 %2.97 %2.81 %0.62 %0.14 %Resource Forks6.67 %5.56 %5.00 %5.13 %4.60 %Weighted Avg.3.76 %3.00 %2.84 %0.72 %0.26 %

His test already shows that some level of fragmentation already exists.

His weighted averages are vague at best since the data he used to determine this is missing. I'm assuming he is using total disk space to derive the average for each since all 5 disks are not of equal capacity. It appears that's the case anyway, so he gets a head start in his favor for unused space.

That must be eliminated, you must use actual space allocated.

Fragmentation occurs at the file level, not the disk.

So based on the information provided from Table 1 and Table 2.

I eliminated his weighted averages and used his actuals.

Actual size 37.26 GB,74.52 GB,74.52 GB,149.04 GB,148.93 GB

Allocated 12.49 GB,44.71 GB,44.83 GB,147.62 GB,140.99 GB

Here is the results I get when using his own data.

You will see the actual percentage with the amount of allocated disk space that is fragmented.

5.195% or 648MB, 4.265% or 1.9GB, 3.905% or 1.75GB, 2.875% or 4.24GB, 2.37%

Side note: I did notice that the G5 appeared to perform much better than the others at maintaining a clean file system. It also appears that HFS+ performs better on larger volumes based on this data.

It all boils down to the math. That's the nice thing about statistical analysis... you can make the data say what ever you want it to. He did it by throwing in a variable that for all intense purposes means nothing. And the proof is in his own raw data.

But to answer the all important question of defraging the drive... After reviewing the data, probably not as often as I would have originaly thought.

I couldn't say for sure how often but based on the data there appears to be an average growth rate of fragmentation of approx. 3.72% between the 5 systems over a 6 month time period.

I won't go into his research method since this is obviosly a summary and some key information as to how he arrived at certain conclusions is missing.

It all boils down to how you look at and play with the numbers.

Something he may have deemed irrelevent may have been important in coming to a proper conclusion. Again, can't say as the data is not all there.

Regardless, HFS+ does fragment, agreed that it's nowhere near as bad as NTFS, but it does nonetheless.

#233407

I have just run the hfsdebug tool on my PowerBook and got very similar results to those found in the PB15 example. I then moved my saved mpeg movie files (~1GB each, 5 files) to random points around my file system several times then back to their original location (not sure if this is a valid test, but hey ho...) and the results were pretty much the same as before.
You would have to move the file to another disk and back or make copies of the files to see a difference.

Simply moving a file around in the same filesystem only changes it's reference pointer, the file doesn't actualy move.

#233411

Right, I'll try that later. Would shifting them to and from an external disk and making copies in various places do it?

#233467

Right, I'll try that later. Would shifting them to and from an external disk and making copies in various places do it?
Yep.

The thing is you need to make the OS write a new file. By moving a file from one disk or logical partition to another and back again, the OS will essentialy write a new file with each move.

A move from on disk or partition is actualy a copy and then a delete.

It copies the original to it's new location and then deletes it from the source location once the copy is complete.

Copying from within the same partition/disk or to another partition/disk, is just that, the OS make a duplicate of the existing file. Hence it creates a new file.

I probably over explained the process, but I think you get the idea.

I have a tendancy to do that. :D

#233515

You will see the actual percentage with the amount of allocated disk space that is fragmented.

5.195% or 648MB, 4.265% or 1.9GB, 3.905% or 1.75GB, 2.875% or 4.24GB, 2.37%

Even using your own interpretation of the data (which I don't necessarily trust the accuracy of), the highest % fragmentation is 5%. This is on a very tiny drive as well. 5% (using the other percentages, probably more like 2-3%) is NOTHING. You don't have to defrag at less than 10%.

And you also make the assumption that the fragmentation will continue to increase as time goes on. I've never seen this happen on UNIX (again, under normal conditions). The Linux system I'm on right now is at 2.5% fragmentation. This install is almost 2 years old though, and it was at 2% a few months after I installed. I also have very little space left, and move around big files (yeah, stupid me). So it seems that UNIX File Systems (or at least non-NTFS systems) have 1-4% fragmentation, and that's about it. This is most likely due to certain files that can't be defragmented. I know NTFS/Windows is like this.

I guess you could still say you have to defragment at 5%, but even Microsoft doesn't think that. NTFS gets 20-40% fragmented easily. In fact, I bet if you defragmented at the 1-5%, it would still remain about that.

#233555

Yes, HFS+ doesn't fragment unless it gets REALLY full and it needs to. So unless you're always moving around huge files on a full drive, you're fine.

Mac OS X automatically fragments big files..

#233560

True, 5% is really nothing to worry about in the grand scheme of things.

Since the data regarding the condition of the disks he tested did not include snapshots at timed intervals, it would be difficult to accurately predict growth rate, if any at all.

So I assumed, as with any new install, the disks started off with 0% fragmentation and then went from there. Yes, I know what it means to assume.

Then again, I used my own personal experience with HFS+ and used that as my basis for making the assumption and coming to the conclusion.

I do, however agree that there may come a point in time where fragmentation will reach a certain level and true growth no longer occurs.

My iBook is currently around 4% right now, and I haven't done any maintanance in two months.

Truthfuly speaking I don't ever think it got above 5 or 6%, but then I'm always on top of it... most of the time anyway.

I'm also constantly installing and uninstalling apps and working with large wave files all the time.

I use an M-Box on it with Pro Tools to lay down quick guitar tracks or make rough mixes. The files can get pretty big.

I have the disk split into two partitions, so only one partition gets really hammered.

It also happens to be the one with the most fragmentation.

Question... are you using HFS+ or HFS+ with journaling?

I'm using journaling on my System partition and straight HFS+ on my extended partition. Not sure if it really makes a difference or not on performance, so I chose not to have the extra overhead on basicaly a scratch disk/partition, since that's all that particular partition is used for anyway.

Edit: Anyway... I think we've beaten this dead horse long enough.

It's getting pretty gooey after a few days. :)

Peace

#233565