To restore or undelete files to their previous state using the -f, –filter option :
snapraid fix -f FILE
WARNING: The “fix” command does not differentiate between errors and intentional modifications.
snapraid fix -f DIR/
To recover only accidentally deleted files inside a directory using the -m, –filter-missing option, that restores only missing files, leaving untouched all the others.
snapraid fix -m -f DIR/
To recover all the deleted files in all the drives:
snapraid fix -m
To recover all the deleted files in a specific data disk:
snapraid fix -m -d d1
snapraid fix -m -f Test/
NOTE: This will recreate the contents of any folder named Test anywhere in the array.
Find the absolute path of the file to be recovered.
snapraid diff --test-fmt path
returns:
Loading state from /var/snapraid.content... Comparing... add /mnt/disk03/Dir1/Subdir1/TVShow1.mkv add /mnt/disk02/Dir2/Subdir2/TVShow2.mkv ... update /mnt/disk03/Dir3/Subdir3/TVShow3.mkv update /mnt/disk03/Dir3/Subdir3/TVShow4.mkv ... copy /mnt/disk02/Dir4/Subdir4/TVShow5.mkv -> /mnt/disk03/Dir4/Subdir4/TVShow5.mkv copy /mnt/disk02/Dir4/Subdir4/TVShow6.mkv -> /mnt/disk03/Dir4/Subdir4/TVShow6.mkv ... move /mnt/disk04/Dir5/Subdir5/TVShow7.mkv -> /mnt/disk04/Dir5/Subdir5x/TVShow7.mkv move /mnt/disk04/Dir5/Subdir5/TVShow8.mkv -> /mnt/disk04/Dir5/Subdir5x/TVShow8.mkv ... remove /mnt/disk01/Dir6/Subdir6/TVShow9.mkv remove /mnt/disk01/Dir6/Subdir6/TVShow10.mkv ... 550112 equal 294 added 1571 removed 5 updated 7 moved 1432 copied 0 restored There are differences!
NOTE: The –test-fmt path option returns the absolute file paths instead of relative paths.
Various changes are shown in the example above, including:
snapraid diff --test-fmt disk
returns:
Loading state from /var/snapraid.content... Comparing... add d3:Dir1/Subdir1/TVShow1.mkv add d2:Dir2/Subdir2/TVShow2.mkv ... update d3:Dir3/Subdir3/TVShow3.mkv update d3:Dir3/Subdir3/TVShow4.mkv ... copy d2:Dir4/Subdir4/TVShow5.mkv -> d3:Dir4/Subdir4/TVShow5.mkv copy d2:Dir4/Subdir4/TVShow6.mkv -> d3:Dir4/Subdir4/TVShow6.mkv ... move d4:Dir5/Subdir5/TVShow7.mkv -> d4:Dir5/Subdir5x/TVShow7.mkv move d4:Dir5/Subdir5/TVShow8.mkv -> d4:Dir5/Subdir5x/TVShow8.mkv ... remove d1:Dir6/Subdir6/TVShow9.mkv remove d1:Dir6/Subdir6/TVShow10.mkv ... 550112 equal 294 added 1571 removed 5 updated 7 moved 1432 copied 0 restored There are differences!
NOTE: This returns the actual data disk where some change has occurred since the last sync.
Various changes are shown in the example above, including:
snapraid check -v -m -f "/Dir1/Subdir1/"
returns:
Self test... Loading state from /var/snapraid.content... 551695 files 0 hardlinks 0 symlinks 970 empty dirs Searching disk d1... Excluding content '/mnt/disk01/.snapraid.content' Excluding directory '/mnt/disk01/lost+found' for rule 'exclude /lost+found/' Searching disk d2... Excluding directory '/mnt/disk02/lost+found' for rule 'exclude /lost+found/' Excluding content '/mnt/disk02/.snapraid.content' ... Selecting... /Dir1/Subdir1/ <missing> Scanning disk d1... Scanning disk d2... ... Using 8981 MiB of memory for the file-system. Initializing... Selecting... Checking... recoverable Dir1/Subdir1/File1.mkv recoverable Dir1/Subdir1/File2.mkv recoverable Dir1/Subdir1/File3.mkv ... 100% completed, 86580 MB accessed in 0:06 37633 errors 0 unrecoverable errors WARNING! There are errors!
NOTE: This shows that these file are recoverable.
snapraid fix -m -f "/Dir1/Subdir1/"
returns:
Self test... Loading state from /var/snapraid.content... Searching disk d1... Searching disk d2... ... Selecting... Scanning disk d1... Scanning disk d2... ... Using 8981 MiB of memory for the file-system. Initializing... Selecting... Fixing... recovered Dir1/Subdir1/File1.mkv recovered Dir1/Subdir1/File2.mkv recovered Dir1/Subdir1/File3.mkv 100% completed, 86580 MB accessed in 0:06 37633 errors 37633 recovered errors 0 unrecoverable errors Everything OK
NOTE: This should recover the directory and files.