What causes an HFS+ filesystem to be marked as "dirty"?

7,156

Solution 1

Volumes are marked dirty when they are mounted read/write. They are marked clean when they are safely unmounted. That way, if the cable is yanked or the machine or drive or an intervening hub loses power or crashes, it stays marked as dirty so that it will automatically be checked on the next mount.

Solution 2

Disconnecting it from the computer incorrectly. Most PC's/macs have a way to dismount a volume before disconnecting it.

Share:
7,156
Assembler
Author by

Assembler

Updated on September 18, 2022

Comments

  • Assembler
    Assembler over 1 year

    I have an external (USB) hard drive which I use for backup of my Mac OS X 10.7.3 system. On a couple occasions when I have plugged in this drive, instead of mounting the drive, a fsck_hfs process starts taking up a lot of CPU for an hour or more.

    I checked the system logs, and in /var/log/fsck_hfs.log I found this:

    /dev/rdisk3s2: fsck_hfs run at Thu Mar 15 15:41:28 2012
    /dev/rdisk3s2: ** /dev/rdisk3s2 (NO WRITE)
    /dev/rdisk3s2:    Executing fsck_hfs (version diskdev_cmds-540.1~34).
    QUICKCHECK ONLY; FILESYSTEM DIRTY
    
    /dev/rdisk3s2: fsck_hfs run at Thu Mar 15 15:41:28 2012
    /dev/rdisk3s2: ** /dev/rdisk3s2
    /dev/rdisk3s2:    Executing fsck_hfs (version diskdev_cmds-540.1~34).
    ** Checking Journaled HFS Plus volume.
       The volume name is Backup
    ** Checking extents overflow file.
    ** Checking catalog file.
       Invalid index key
    (4, 155747)
    /dev/rdisk3s2: ** Rebuilding catalog B-tree.
    ** Rechecking volume.
    ** Checking Journaled HFS Plus volume.
       The volume name is Backup
    ** Checking extents overflow file.
    ** Checking catalog file.
       Incorrect number of thread records
    (4, 28703)
    /dev/rdisk3s2: ** Checking multi-linked files.
    ** Checking catalog hierarchy.
       Invalid directory item count
       (It should be 4 instead of 2)
    ** Checking extended attributes file.
       Invalid index key
    (8, 148499)
    /dev/rdisk3s2: ** Rebuilding extended attributes B-tree.
    

    ...and it's still running at the moment, or I'd show the rest of the output.

    In most of the previous fsck_hfs logs, it says "QUICKCHECK ONLY; FILESYSTEM CLEAN" and nothing more.

    It's been a while since this has happened, but I believe after the check runs, sometimes the filesystem will mount as read-only. Yet again this is sporadic: sometimes the drive mounts just fine and my Time Machine backup runs without issue.

    What could be causing my drive to be marked as dirty? Is this a hardware fault or perhaps a software one? Did I just get unlucky?

  • Assembler
    Assembler about 12 years
    I don't believe I've ever done this; I think I'm always careful to eject the disk before unplugging it. How unlikely are any other possibilities?
  • Phillip R.
    Phillip R. about 12 years
    As spiff states above, quite unlikely. The external drive could have some faulty sectors or the controller card inside the housing could have something screwy with it. But the logical answer would be unmounting incorrectly or forcing an unmount while writing to the disk.