Zfs
Single disc
tank is the storage name
zpool create tank /dev/sdb
zpool create -o ashift=12 -o autotrim=on -o autoexpand=on
zpool create -o ashift=12 -o autotrim=on tank mirror /dev/disk/by-id/usb-SanDisk_SDSSDA-1T00_0123456789CA-0:0 /dev/disk/by-id/usb-SanDisk_SDSSDA-1T00_0123456789CB-0:0
zfs set atime=off compression=lz4 tank
zpool set autotrim=on tank
zpool trim tank
zpool status -t
cache file
zpool set cachefile=none tank
mirror pool (similar to raid-1, ≥ 2 disks, 1:1 redundancy)
zpool create tank mirror /dev/sdb /dev/sdc
stripe pool (similar to raid-0, no redundancy)
zpool create tank /dev/sdb /dev/sdc
Add cache disk
zpool add tank cache /dev/nvme-MT001600KWHAC_S3M0NA0K700264
deduplication
zfs set dedup=on tank
compression
zfs set compression=on tank
list dics
lsblk --ascii -o NAME,PARTUUID,LABEL,PATH,FSTYPE
lsusb -t
lsblk -o NAME,MOUNTPOINT,PHY-SEC,LOG-SEC,OPT-IO,FSTYPE
mount |column -t
lsblk -o NAME,FSTYPE,UUID,RO,RM,SIZE,STATE,OWNER,GROUP,MODE,TYPE,MOUNTPOINT,LABEL,MODEL
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,MODEL,SERIAL,HCTL,PHY-SEC,LOG-SEC
Ich habe gestern, weil mein mdadm Software Raid auf dem Raspberry PI nicht so richtig funktioniert, die USB Ports verschwinden aus /dev, eine drehende Platte an meinen Linux Server angeschlossen. Dann mit zpool (ZFS) einen pool mit nur einer Platte erzeugt. Dann habe ich die Daten vom PI per Netzwerk auf die neue Platte kopiert. Das mdadm RAID auf dem PI aufgelöst und die Platten zu dem Pool als Mirror platten hinzugefügt. Dann nach dem Sync die drehende Platte entfernt. Klingt kompliziert. Aber mit ZFS war das echt einfach.
zpool create tank /dev/sdb
zpool attach tank /dev/sdb /dev/sdc /dev/sdd
zpool status
zpool detach tank /dev/sdb
zpool status
reboot
Determining Available Storage Pools to Import
After the pool has been removed from the system (either through an explicit export or by forcefully removing the devices),
you can attach the devices to the target system. ZFS can handle some situations in which only some of the devices are available,
but a successful pool migration depends on the overall health of the devices. In addition,
the devices do not necessarily have to be attached under the same device name. ZFS detects any moved or renamed devices,
and adjusts the configuration appropriately. To discover available pools, run the zpool import command with no options.
don’t use raidz(x)
DON’T use raidz!! use mirrors! https://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html
zpool create tank mirror sda sdb
zpool add tank mirror sdc sdd
better use /dev/disk/by-id/ rather than /dev/sd
zpool add tank log mirror sde sdf
zpool add tank cache sdg sdh
zfs command
zfs create tank/data
zfs create tank/data/dummy
zfs create tank/data/joe
zfs set quota=100G tank/data/joe
zfs create tank/data/jane
zfs set reservation=2G tank/data/jane
settings
zfs get all tank
zfs set atime=off tank
scrub / maintain
zpool scrub tank
stop srub
zpool scrub -s tank
slow scrub https://www.reddit.com/r/zfs/comments/iuh5lj/how_can_i_slow_down_a_scrub_on_purpose_to_leave/
checksum error
zpool clean tank
zpool clean tank usb-SanDisk_SDSSDA-1T00_0123456789CA-0:0
https://dan.langille.org/2019/10/15/creating-a-mirror-from-your-zroot/
meta data
Only OpenZFS 2.0 or later!
https://forum.level1techs.com/t/zfs-metadata-special-device-z/159954
re-import disc-by-id
disc by id
zpool export tank
zpool import -d /dev/disk/by-id/ tank