gedankensplitter/filesystems.md

57 lines
2.2 KiB
Markdown
Raw Normal View History

2022-03-27 18:17:44 +00:00
# Filesystems
2023-12-28 08:54:49 +00:00
### btrfs
#### btrfs scrub
2022-03-27 18:17:44 +00:00
As a copy-on-write (COW) filesystem btrfs can compensate some errors from the underlying storage
2022-07-27 11:58:20 +00:00
- check checksum on READ
- fix logical block if valid copy is available (RAID1, RADI5/&, DUP)
- 07.2022 no force WRITE-VERIFY possible -> look downwards
2022-07-21 13:56:02 +00:00
##### 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/
```
2022-03-27 18:17:44 +00:00
##### 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.
2023-12-28 08:54:49 +00:00
### 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
```
2022-03-27 18:17:44 +00:00
### ATA/SMART
#### hdparm
2022-07-27 11:58:20 +00:00
##### 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`
2022-03-27 18:17:44 +00:00
```
/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
```
2022-07-27 11:58:20 +00:00
If it tells you `write-read-verify = 2` then the feature is enabled
2022-03-27 18:17:44 +00:00
#### 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.