{{tag>snapraid linux}} ======snapraid====== I have been using [[https://www.snapraid.it/|snapraid]] since circa 2015 for my main first past redundancy. I have a second home server used as a backup server that weekly backs up using [[home_server:home_server_setup:other_services:back-up_server#restic]]. The main snapraid commands I use are: ''sudo snapraid sync'' to sync the files that have changes since last sync. I usually do this weekly, manually. ''sudo snapraid scrub'' to check the parity of the array, usually the oldest files first. I usually do this weekly, manually. ''sudo snapraid status'' to check the status of the array. I usually do this weekly, manually. ''sudo snapraid touch'' to add sub-second time granularity to the files that improves snapraid usage. I usually do this weekly, if reported as requried by status, manually. ''sudo snapraid smart'' to check the smart status of the array drives (does not report on nvme drives). I usually do this weekly, manually. Really for information only. Snapraid allows files and directories that have been deleted since the last sync to be recovered. *''snapraid diff --test-fmt path'' *''snapraid diff --test-fmt disk'' This will let you know the data disk from snapraids array perspective Snapraid does not expect you to provide the absolute file system path when fixing files. *''snapraid fix -m'' This will recreate any deleted file in the entire array *''snapraid fix -m -d d1'' This will recreate any deleted file on data disk d1 *''snapraid fix -m -f Example/'' This will recreate the contents of any folder named Example anywhere in the array *''snapraid check -m -f Example/ -v'' If you are unsure what will happen you can replace fix with check above and add -v with this. Snapraid will then tell you that there is a problem with each of the files matching the filter or that they are ok. The main snapraid configuration file ''/etc/snapraid.conf'' ++++Install Snapraid on Linux| Some good references are [[https://zackreed.me/setting-up-snapraid-on-ubuntu/|Setting up SnapRAID on Ubuntu to Create a Flexible Home Media Fileserver]] and [[https://havetheknowhow.com/configure-the-server/install-snapraid/|How to install and configure SnapRAID on Ubuntu Server]] apt-get install gcc git make -y cd wget https://github.com/amadvance/snapraid/releases/download/v12.3/snapraid-12.3.tar.gz tar xzvf snapraid-12.3.tar.gz cd snapraid-12.3/ ./configure make make check make install cd .. cp ~/snapraid-12.3/snapraid.conf.example /etc/snapraid.conf cd .. rm -rf snapraid* ++++ ++++My main server configuration files, /etc/snapraid.conf| I probably should check this configuration file against the latest version example. My current operating version is 12.0 (2021/12) the latest version is 12.4 (2025/01), there looks to be mainly some minor optimisations and bug fixes. # Example configuration for snapraid # Defines the file to use as parity storage # It must NOT be in a data disk # Format: "parity FILE [,FILE] ..." parity /media/disk3/snapraid.parity # Defines the files to use as additional parity storage. # If specified, they enable the multiple failures protection # from two to six level of parity. # To enable, uncomment one parity file for each level of extra # protection required. Start from 2-parity, and follow in order. # It must NOT be in a data disk # Format: "X-parity FILE [,FILE] ..." #2-parity /mnt/diskq/snapraid.2-parity #3-parity /mnt/diskr/snapraid.3-parity #4-parity /mnt/disks/snapraid.4-parity #5-parity /mnt/diskt/snapraid.5-parity #6-parity /mnt/disku/snapraid.6-parity # Defines the files to use as content list # You can use multiple specification to store more copies # You must have least one copy for each parity file plus one. Some more don't hurt # They can be in the disks used for data, parity or boot, # but each file must be in a different disk # Format: "content FILE" content /home/snapraid.content content /media/disk1/snapraid.content content /media/disk2/snapraid.content # Defines the data disks to use # The name and mount point association is relevant for parity, do not change it # WARNING: Adding here your /home, /var or /tmp disks is NOT a good idea! # SnapRAID is better suited for files that rarely changes! # Format: "data DISK_NAME DISK_MOUNT_POINT" data d1 /home/shared data d2 /media/disk1/ data d3 /media/disk2/ # Excludes hidden files and directories (uncomment to enable). #nohidden # Defines files and directories to exclude # Remember that all the paths are relative at the mount points # Format: "exclude FILE" # Format: "exclude DIR/" # Format: "exclude /PATH/FILE" # Format: "exclude /PATH/DIR/" exclude *.unrecoverable exclude /tmp/ exclude /lost+found/ exclude /.Trash-0/ exclude /*.vhdx exclude .thumbs.db exclude /VMs/ exclude /home/shared/www/html/logs/ exclude logs/ exclude log/ #exclude .config/ exclude .cache/ exclude /home/baumkp/.vnc/ exclude .log # Defines the block size in kibi bytes (1024 bytes) (uncomment to enable). # WARNING: Changing this value is for experts only! # Default value is 256 -> 256 kibi bytes -> 262144 bytes # Format: "blocksize SIZE_IN_KiB" #blocksize 256 # Defines the hash size in bytes (uncomment to enable). # WARNING: Changing this value is for experts only! # Default value is 16 -> 128 bits # Format: "hashsize SIZE_IN_BYTES" #hashsize 16 # Automatically save the state when syncing after the specified amount # of GB processed (uncomment to enable). # This option is useful to avoid to restart from scratch long 'sync' # commands interrupted by a machine crash. # It also improves the recovering if a disk break during a 'sync'. # Default value is 0, meaning disabled. # Format: "autosave SIZE_IN_GB" autosave 100 # Defines the pooling directory where the virtual view of the disk # array is created using the "pool" command (uncomment to enable). # The files are not really copied here, but just linked using # symbolic links. # This directory must be outside the array. # Format: "pool DIR" #pool /pool # Defines a custom smartctl command to obtain the SMART attributes # for each disk. This may be required for RAID controllers and for # some USB disk that cannot be autodetected. # In the specified options, the "%s" string is replaced by the device name. # Refers at the smartmontools documentation about the possible options: # RAID -> https://www.smartmontools.org/wiki/Supported_RAID-Controllers # USB -> https://www.smartmontools.org/wiki/Supported_USB-Devices #smartctl d1 -d sat %s #smartctl d2 -d usbjmicron %s #smartctl parity -d areca,1/1 /dev/sg0 #smartctl 2-parity -d areca,2/1 /dev/sg0 ++++ <- home_server:home_server_setup:other_services:index|Prev ^ home_server:home_server_setup:other_services|Start page ^ home_server:home_server_setup:other_services:timedate|Next ->