ESN 81040-080421-727532-51


Document Name: htfsdebug
Document Description: htfsdebug examines OS X HFS+ filesystems

htfsdebug


2008/04/21

You can download "htfsdebug" from Amit Singh's "Mac OS X Internals" site.. It's a tool that will examine your HFS+ filesystems and report various statistics. Although presented as a "debugger", it's really not: this is strictly read-only. However, it can provide a lot of useful and interesting information.

For example, here is it's "summary" output. By specifying "-t 10", I asked it to only list the ten largest files it found on my disk:

 $ sudo  hfsdebug -s -t 10
 Password:
 
 # Volume Summary Information
     files                          = 526923
     folders                        = 102959
     aliases                        = 0
     hard links                     = 5552
     symbolic links                 = 32556
     invisible files                = 222
     empty files                    = 8062
   # Data Forks
     non-zero data forks            = 518689
     fragmented data forks          = 1335
     allocation blocks used         = 17195327
     allocated storage              = 70432059392 bytes
                                      (68781308.00 KB/67169.25 MB/65.59 GB)
     actual usage                   = 69052849691 bytes
                                      (67434423.53 KB/65853.93 MB/64.31 GB)
     total extent records           = 521165
     total extent descriptors       = 541078
     overflow extent records        = 2476
     overflow extent descriptors    = 19519
   # Resource Forks
     non-zero resource forks        = 1068
     fragmented resource forks      = 2
     allocation blocks used         = 15638
     allocated storage              = 64053248 bytes
                                      (62552.00 KB/61.09 MB/0.06 GB)
     actual usage                   = 60915072 bytes
                                      (59487.38 KB/58.09 MB/0.06 GB)
     total extent records           = 1068
     total extent descriptors       = 1071
     overflow extent records        = 0
     overflow extent descriptors    = 0
 
 896 files have content in both their data and resource forks.
 
 # Largest Files (data forks) on the Volume
 # Using 1 KB = 1024 bytes, 1 MB = 1024 KB, 1 GB = 1024 MB
 rank      size       cnid path
 1      7.40 GB    9079398 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
 2      4.79 GB    6254336 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{5e74b8f6-c1ea-432d-8227-4a33b2cf8447}.hds
 3      2.99 GB    8659761 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{3887679c-52c3-4dc7-9199-a4240cf61062}.hds
 4      2.97 GB   10390184 Macintosh HD:/Users/apl/Documents/Virtual Machines/
 Ubuntu.vmwarevm/Ubuntu.vmdk
 5      2.43 GB    6265728 Macintosh HD:/Desktop/vmware/vmware/SCO/SCO.vmdk
 6      2.37 GB    6524650 Macintosh HD:/Users/apl/Library/Parallels/
 Ubuntu/lin26.hdd/lin26.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
 7      2.00 GB    9446500 Macintosh HD:/private/var/vm/sleepimage
 8      1.83 GB    8655591 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{aa7d9a8c-9391-4324-b35e-12255889da67}.hds
 9      1.16 GB    6267051 Macintosh HD:/Desktop/vmware/vmware/SCO507/SCO507.vmdk
 10   1024.00 MB   10979700 Macintosh HD:/private/var/vm/swapfile5
 

I probably could have guessed that VMware and Parallels images would be my biggest files, and I wasn't surprised to see a swapfile mixed in, but what is that /private/var/vm/sleepimage? Well, actually that's something I don't need now because I use RAM Sleep Mode, so I could save myself a bit of space by removing it (and I did).

This can also show fragmentation, though Amit says HFS+ defrags on the fly anyway and does other things that make fragmentaion a non-issue. Tallying up fragmented files can take quite a while to run, but does give a summary at the end:

 # Top 5 Files with the Most Extents on the Volume
 rank    extents   blk/extents       cnid path
 1         10497          4.17   10480743 Macintosh HD:/private/var/log/system.log
 2          2025        957.97    9079398 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds
 3          1255        623.78    8659761 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{3887679c-52c3-4dc7-9199-a4240cf61062}.hds
 4           819       1533.34    6254336 Macintosh HD:/Users/apl/Library/Parallels/Microsoft 
 Windows XP ie6/winxp.hdd/winxp.hdd.0.{5e74b8f6-c1ea-432d-8227-4a33b2cf8447}.hds
 5           679       1145.24   10390184 Macintosh HD:/Users/apl/Documents/Virtual Machines/
 Ubuntu.vmwarevm/Ubuntu.vmdk
 
 Out of 518680 non-zero data forks total, 517346 (99.74 %) have no fragmentation.
 Out of 1068 non-zero resource forks total, 1066 (99.81 %) have no fragmentation.
 

So that looks pretty good, doesn't it? By the way, Amit has a number of very interesting articles at http://www.osxbook.com/book/bonus/ and I do recommend his excellent Mac OS X Internals Book also.


Author: Anthony Lawrence - Contact Author
Publisher: Anthony Lawrence
Licensee Name: Anthony Lawrence
Reference URL: http://aplawrence.com/MacOSX/htfsdebug.html
Copyright: All Rights Reserved
Registration Date: 4/21/2008 9:48:51 PM UTC
Views: 372




NUMLY.COM