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.

How?

Find the time machine disk, open Terminal.app, 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),
respectively.

pmset is a command line tool that apple has bundled in their OS X operating system. Its purpose is to display and/or modify the power management settings. Here is a modified settings in order to: 1. Save battery power as much as possible; 2. let you return to work as soon as possible.

battery mode (pmset -b)

Write the hibernation image to disk and powering off memory for Standby after 6 hours.

pmset -b standbydelay 21600

Sleep after 10 minutes idle.

pmset -b sleep 10

Spindown disk after 30 minutes idle.

pmset -b disksleep 30

Set hibernatemode to 3. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

pmset -b hibernatemode 3

Turn down display after 5 minutes idle.

pmset -b displaysleep 5

Poweroff after 8 hours to save power.

pmset -b autopoweroffdelay 28800

charger mode (pmset -c)

In charger mode, I would like to change hibernatemode to 0. So that the system can be waked up quickly. In this mode, the system will not back memory up to persistent storage. The system must wake from the contents of memory, the system will lose context on power loss.

pmset -c hibernatemode 0

Standby, the manual said, standby only works if hibernation is turned on to hibernatemode 3 or 25. Here I set it the same as battery mode