Jump to content
IGNORED

paranoid about NAS music file integrity


Recommended Posts

Hi guys!

 

With all my music digitalized and on my big Synology NAS, I'm starting to get worried about file integrity (aka bit rot).

 

So I experimented on my small NAS (a well-aged Synology DS214se) with some scripts to generate and check MD5 sums. To this end, I manually installed md5deep from the ipkg feed (didn't feel like installing all of ipkg) from here:

Index of /feeds/optware/cs08q1armel/cross/stable/

I just unpacked the data.tar.gz from the package and copied opt/bin/md5deep to /opt/bin/md5deep on my Synology.

 

Then I wrote a little script to create and check the MD5 hash for a given file:

 

#!/bin/sh
echo -n "Processing $1 ... "
if [ -f "$1.md5" ]
then
 cp "$1" "$1.tmp"
 mv "$1.tmp" "$1"
 /opt/bin/md5deep -m "$1.md5" "$1" > /dev/null
 status=$?
 if [ $status -ne 0 ]
 then
   echo "FAILURE - hash value has changed"
 else
   echo "OK - hash values match"
 fi
else
 /opt/bin/md5deep -b "$1" > "$1.md5"
 echo "FIRST - stored MD5 hash"
fi

 

Being my paranoid self, I also refresh the file by copying it to a new name and moving it back to the original name. This should refresh the bits nicely :D

 

Finally, to check all WAV files on the "media" volume, I run the following command from my Mac Pro's terminal:

 

ssh [email protected] -t "find /volume1/media/Music/ -iname '*.wav' -exec /opt/bin/regen.sh '{}' \;" | tee regen.log

 

The log file contains FIRST for all files that were first seen and got hashed, OK for those where the computed hash matched the stored one, and FAILURE when there is bit rot (easily simulated by corrupting an .md5 file or a .wav file by hand).

 

I thought about getting a NAS with ZFS or BTRFS support, but all I would use that for is checksumming - so that can be done just as well using my above script. And I like DSM too much :)

 

What do you do to combat bit rot?

 

Edit: If you want to know how to do this on your NAS, I can give more detailed descriptions. Just let me know.

Link to comment

I thought about getting a NAS with ZFS or BTRFS support, but all I would use that for is checksumming - so that can be done just as well using my above script.

 

BTRFS and ZFS (but not the limited implementation being introduced by Synology, AFAIK) can automatically repair bit rot, not just detect it.

Link to comment
Oh, forgot to say, "Welcome!"

 

Thanks! After reading here for like 5 years, it us funny to be contributing actively :)

 

Your ALAC script is great, as it seems to care only for the PCM data. For my purposes this will be hard to replicate on the synology, as it requires parsing ALAC files.

 

My reason for staying in the synology is that I want to have it monitor the file integrity status regularly and notify me of any irregularities whenever they are detected.

Link to comment

Echo what folks have said above. ZFS & BTRFS can repair disc errors/bit rot as long as you have redundancy in your pools i.e. Use mirroring or raid5/6 etc. if you don't have redundancy ZFS can't repair either. These modern file systems go waay beyond simple scripts in terms of data integrity, particularly if you also use ECC RAM in which case they can also protest against Martian invasions:)

Custom room treatments for headphone users.

Link to comment

Hi,

If you want to add extra redundancy to your files (if your NAS filesystem is not ZFS or BTRFS) you could use PAR2 (QuickPar for Windows) to add extra-files to each directory. This tool was widely used on binary Usenet newsgroup to help in case you missed some part of downloaded data.

It adds some extra files that can be used to check and recover lost bits.

My 2 cents...

 

Greg.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...