1. 13
  1.  

  2. 2

    If someone is interested, I’ve done a small script to batch check all the JPEGs in a folder:

    #!/bin/bash
    IMAGE_DIR=/path/to/images
    
    export IFS=$'\n'
    FILES=$(find "$IMAGE_DIR" -iname "*.jpg")
    for FILE in $FILES; do
        djpeg -fast -grayscale -onepass "$FILE" > /dev/null
        if [ "$?" != "0" ]; then
            echo "NOT OK: $FILE"
        fi
    done
    

    It requires djpeg, part of libjpeg (brew install libjpeg).

    1. 1

      It’s a bit sad that in 2014, ZFS is still the only filesystem that checksums data (as opposed to metadata only). I am worried that my backup disk is becoming increasingly corrupted without me knowing.

      1. 2

        Not to be too pedantic, but btrfs and nilfs also checksum data. There’s also a comparison of filesystems and their features here. I don’t recognize most of the file systems that support it, and I think that fundamentally it’s because checksumming is something you don’t need your file system to do. It’s fine to just do it yourself if your data matters that much. In fact, for most file systems, it’s just as good to have someone just manually figure out your checksum is broken, because there’s nothing you can do about it!

        What makes zfs and btrfs thrilling is that they maintain all of these snapshot versions, so if they detect data corruption, they can do self-healing by comparing against other snapshots. Snapshotting is a relatively new feature for filesystems, so it makes sense that checksumming is too.

        The other thing is that it’s difficult to add new features to a file system, so people often do it by just making an entirely new version of the file system, so it’s fairly straightforward why only the newest file systems have this new feature.