User Tools

Site Tools


snapraid:recover_a_lost_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
snapraid:recover_a_lost_file [2025/04/29 17:15] – [Restore Files] petersnapraid:recover_a_lost_file [2025/09/11 10:09] (current) – [Restore the contents of a directory] peter
Line 15: Line 15:
  
 </WRAP> </WRAP>
- +
 ---- ----
  
Line 46: Line 46:
 ---- ----
  
 +===== Restore All Deleted Files on Data Disk d1  =====
 +
 +To recover all the deleted files in a specific data disk:
 +
 +<code bash>
 +snapraid fix -m -d d1
 +</code>
 +
 +----
 +
 +===== Restore the contents of any specifically named directory in all drives =====
 +
 +<code bash>
 +snapraid fix -m -f Test/
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  This will recreate the contents of any folder named Test anywhere in the array.
 +</WRAP>
 +
 +----
 +
 +===== Get the absolute path from the file system perspective of any changes since the last sync =====
 +
 +Find the absolute path of the file to be recovered.
 +
 +<code bash>
 +snapraid diff --test-fmt path
 +</code>
 +
 +returns:
 +
 +<code>
 +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!
 +
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  The **--test-fmt path** option returns the absolute file paths instead of relative paths.
 +
 +Various changes are shown in the example above, including:
 +
 +  * **Add** - Some files have been added since the last sync.
 +  * **Update** - Some files have been updated since the last sync.
 +  * **Copy** - Some files have been copied since the last sync.
 +  * **Move** - Some files have been moved since the last sync.
 +  * **Remove** - Some files have been removed since the last sync.
 +
 +</WRAP>
 +
 +----
 +
 +===== Get the data disk from snapraids array perspective of any changes since the last sync =====
 +
 +<code bash>
 +snapraid diff --test-fmt disk
 +</code>
 +
 +returns:
 +
 +<code>
 +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!
 +</code>
 +
 +<WRAP info>
 +**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:
 +
 +  * **Add** - Some files have been added since the last sync.
 +  * **Update** - Some files have been updated since the last sync.
 +  * **Copy** - Some files have been copied since the last sync.
 +  * **Move** - Some files have been moved since the last sync.
 +  * **Remove** - Some files have been removed since the last sync.
 +
 +</WRAP>
 +
 +----
 +
 +===== Check if a fix will work =====
 +
 +<code bash>
 +snapraid check -v -m -f "/Dir1/Subdir1/"
 +</code>
 +
 +returns:
 +
 +<code>
 +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!
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  This shows that these file are **recoverable**.
 +
 +  * Notice that the command used does not use the absolute path, something like **/mnt/disk01/Dir1/Subdir1/**, but only the relevant path, **/Dir1/Subdir1/**. 
 +    * Snapraid does not expect you to provide the absolute file system path when fixing files.
 +
 +</WRAP>
 +
 +----
 +
 +===== Restore the contents of a directory =====
 +
 +<code bash>
 +snapraid fix -m -f "/Dir1/Subdir1/"
 +</code>
 +
 +returns:
 +
 +<code>
 +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
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  This should recover the directory and files.
 +
 +  * Notice that the command used does not use the absolute path, something like **/mnt/disk01/Dir1/Subdir1/**, but only the relevant path, **/Dir1/Subdir1/**. 
 +    * Snapraid does not expect you to provide the absolute file system path when fixing files.
 +
 +</WRAP>
 +
 +----
  
snapraid/recover_a_lost_file.1745946916.txt.gz · Last modified: 2025/04/29 17:15 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki