# Filesystems ### btrfs #### btrfs scrub As a copy-on-write (COW) filesystem btrfs can compensate some errors from the underlying storage - check checksum on READ - fix logical block if valid copy is available (RAID1, RADI5/&, DUP) - 07.2022 no force WRITE-VERIFY possible -> look downwards ##### btrfs resize ``` btrfs filesystem show -d btrfs filesystem resize -500m /dev/mapper/ubuntu--vg-root/@subvolume ``` ##### btrfs snapshot size to show all snapshots enable quotas ``` [root@localhost ~]# btrfs quota enable /btrfs/ [root@localhost ~]# [root@localhost ~]# btrfs qgroup show /btrfs/ ``` ##### systemd handling create for all btrfs filesystems a regulary scrub timer. ```bash for p in $(lsblk -nflo FSTYPE,MOUNTPOINT | awk '$1=="btrfs"{print $2}'); do systemctl enable --now "btrfs-scrub@$(systemd-escape -p "$p").timer"; systemctl start "btrfs-scrub@$(systemd-escape -p "$p").service"; done ``` the manual way of creating is eating the correct escape. ### luks #### on-the-fly encryption of existing file system ``` #reduce filesystem to gain space for the luks header btrfs filesystem resize -32m /mounted_filesystem #create on the fly encrypted filesystem cryptsetup reencrypt --encrypt --reduce-device-size 32m /dev/plaintext_device ``` ### ATA/SMART #### hdparm ##### write-verify with hdparm you can activate the write-verify `-R1` handling, if the drive has got this feature. Most consumer devices do not have this. Otherwise hdparm is more for the temporary set of AAM or APM, ATAsecurity, DCO, e.g. To disable use `-R0` ``` /dev/sdb: [SSD] multcount = 0 (off) IO_support = 1 (32-bit) readonly = 0 (off) readahead = 256 (on) geometry = 31130/255/63, sectors = 500118192, start = 0 /dev/sda: [HDDD] multcount = 16 (on) IO_support = 1 (32-bit) readonly = 0 (off) readahead = 256 (on) geometry = 60801/255/63, sectors = 976773168, start = 0 ``` If it tells you `write-read-verify = 2` then the feature is enabled #### smartmontools the smartmontools contains mainly two features: the smart daemon and the smartctl tool. `smartctl` controls the SMART features of a drive, `smartd` usually surveille and run tests as a daemon with it.