Gih's Blog


Speeding up fsck on the disk of TimeMachine

2014-09-06 by gihnius, tagged as mac

Why fsck?

Sometimes the file system get corrupted and hence you may unable to boot your system. In such case you will need to repair the corrupted file system. In Linux you can repair it using fsck command. In windows we have command chkdsk. In OSX we have "fsck", "fsck_hfs".

There are several reasons behind the file system corruption. For example, improper shutdown, suddenly cut off the power supply, a storage device was removed when system is in process to write the data on it, accidental system file deletion and viruses can cause file corruption and unstable system. Some file corruptions are less harmful and user can continue working. However it is important to run a “fsck” once in a while as a practice.

Why time machine?

Time Machine is Apple's built-in backup solution for OS X that creates hourly backups of all files on the system. It takes many snapshots of your local drive, copies many millions of files to the backup disk volume.  By default, Checking the time machine disk volumes with Disk Utility,  can be painfully slow, taking many hours or days to complete, if it completes at all.


Find the time machine disk, open, type diskutils list, find the line contains Apple_HFS YOUR_DISK_NAME, get the device name from the last column below IDENTIFIER, for example, disk3, disk4...

Run fsck_hfs with 2G memory cache:(adjust less than the system memory)

sudo fsck_hfs -f -y -c 2g /dev/disk3

The key is to increase the size of the cache used by fsck_hfs. see more from manual:

-c size Specify the size of the cache used by fsck_hfs internally.  Bigger size
        can result in better performance but can result in deadlock when used
        with -l option.  Size can be specified as a decimal, octal, or hexadec-
        imal number.  If the number ends with a ``k'', ``m'', or ``g'', the
        number is multiplied by 1024 (1K), 1048576 (1M), or 1073741824 (1G),

Learn about using Disk Utility to verify or repair disks.