Wednesday, October 17, 2018

macos - Mac filesystem and defragmentation


Since the Mac OS is running on something kind of like Linux does that mean that it also doesn't get fragmented?


Answer



HFS+ filesystem - used by Mac OS - avoids reusing space from deleted files as much as possible, to avoid prematurely filling small areas of recently-freed space that causes fragmentation.


OS X 10.2 and above feature delayed allocation for HFS+ volumes. This means that a number of small file allocations can be combined into a single large allocation in one continuous area of the hard disk.


One cause of file fragmentation is usually continually appending data to existing files, especially with resource forks. With faster hard drives and better caching, as well as the new application packaging format, many applications simply rewrite the entire file each time. Mac OS X 10.3 Panther can also automatically defragment such slow-growing files. This process is sometimes known as "Hot-File-Adaptive-Clustering."


Aggressive read-ahead and write-behind caching means that minor fragmentation has less effect on perceived system performance.


So, in normal usage there's no need to defragment hard disks manually. However, if the disks are almost full, and you write large files (such as editing video), there's a fair chance the disks could become fragmented. In such a case, you might benefit from defragmentation.


One point to note is that OS X by itself has no disk defragmentation utils, so some third-party disk utilities are needed for manual defragmentation. Another option to defragment a hard drive without any third party tools is to back up all files, erase the hard disk, (reinstall the OS if operating with the startup disk) and restore backed up files.


(The information above based on Apple's guide about disk optimization.)


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...