Small module that regularly runs btrfs scrub on all btrfs filesystems. Eventually the module should also do SMART value monitoring, as edwin is a server from Hetzner's server auction, so a disk failure may not be too far away. Change-Id: I11e423a5d91c99ad455c2bb29b632efb79ef908e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7294 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			573 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			573 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
# TODO(sterni): configure smartd and alerts
 | 
						|
{ config, lib, ... }:
 | 
						|
 | 
						|
{
 | 
						|
  config = {
 | 
						|
    services = {
 | 
						|
      btrfs.autoScrub = {
 | 
						|
        enable = true;
 | 
						|
        interval = "daily";
 | 
						|
        # gather all btrfs fileSystems and overwrite default
 | 
						|
        fileSystems = lib.mkForce (
 | 
						|
          lib.concatLists (
 | 
						|
            lib.mapAttrsToList
 | 
						|
              (
 | 
						|
                _:
 | 
						|
                { fsType, mountPoint, ... }:
 | 
						|
                if fsType == "btrfs" then [ mountPoint ] else [ ]
 | 
						|
              )
 | 
						|
              config.fileSystems
 | 
						|
          )
 | 
						|
        );
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |