====== ZFS ====== * [[https://wiki.freebsd.org/ZFS]] * **[[https://wiki.freebsd.org/ZFSQuickStartGuide]]** * [[https://web.archive.org/web/20090206093230/http://opensolaris.org:80/os/community/zfs/docs/zfsadmin.pdf]] * [[https://docs.freebsd.org/de/books/handbook/zfs/|Kapitel 19. Das Z-Dateisystem (ZFS)]] * [[::Festplatten]] * **[[https://docs.freebsd.org/de/books/handbook/zfs/|Kapitel 19. Das Z-Dateisystem (ZFS)]]** * **[[https://linuxhint.com/install_zfs_on_freebsd/|Install and Configure ZFS on FreeBSD 12.0]]** * [[https://de.wikipedia.org/wiki/ZFS_(Dateisystem)]] * [[https://docs.oracle.com/cd/E19253-01/820-2313/gaypw/index.html]] - Oracle Solaris ZFS-Administrationshandbuch * [[https://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide]] - ZFS Best Practices Guide * **[[https://www.freebsdfoundation.org/journal/browser-based-edition/|FreeBSD Foundation - Browser-Based Edition]]** * **[[https://issue.freebsdfoundation.org/publication/?i=256344#{%22issue_id%22:256344,%22page%22:20}|FreeBSD - ZFS Best Practices]]** * [[https://www.phoronix.com/scan.php?page=article&item=freebsd-zol-april|FreeBSD ZFS vs. ZoL Performance, Ubuntu ZFS On Linux Reference]] - ZFS-Vergleich zwischen "FreeBSD 12.0" und "Ubuntu 18.04" Dieses Dateisystem verwendet **dynamische Inodes**. * [[https://docs.freebsd.org/doc/10.2-RELEASE/usr/local/share/doc/freebsd/de/books/handbook/book.html#zfs-zpool]] * __ZFS:__ **21.3.6. Behandlung von fehlerhaften Geräten** * __ZFS:__ **21.3.8. Selbstheilung** * __ZFS:__ **21.3.9. Einen Pool vergrössern** ===== Unterstützung ===== ZFS wird natürlich von **Solaris** unterstützt, mittlerweile hat ja auch **FreeBSD** ZFS in den Kernel auf genommen und Apple setzt ebenfalls in **McOS** den ZFS-Treiber in der Art von FreeBSD erfolgreich ein. Nur **Linux** hat noch keine zufriedenstellende ZFS-Unterstützung zu bieten. Allerdings gibt es hier drei verschiedene Lösungswege: - **Fuse** (ist im Paketsystem fast jeder Linux-Distribution enthalten), hier arbeitet ein sehr aktueller ZFS-Treiber im User-Land, ist aber sehr langsam und instabil bei großen Datenmengen; - mit [[http://wiki.debian.org/Debian_GNU/kFreeBSD|kFreeBSD]] setzt man auf einem FreeBSD-Kernel ein Debian User-Land auf, diese Lösung ist beim schreiben sogar etwas schneller als das native FreeBSD aber beim lesen deutlich langsamer; - mit [[http://zfs.kqinfotech.com/|KQ]] wird ein propritärer ZFS-Treiber für Linux bereit gestellt, der in etwa so schnell ist wie FreeBSD, der Treiber wird aber nur für Fedora, RHEL und Ubuntu angeboten; ==== single user mode in FreeBSD mit ZFS auf der System-Platte ==== [[https://rubenerd.com/mount-zfs-in-freebsd-single-user-mode/]] Um das Dateisystem beschreibbar zu machen, genügt dieses Kommando: $ mount -u / ===== ZFS mit Verschlüsselung ===== ZFS-Pool anlegen (ohne Mount-Point): > zpool create -m none HDD1000 /dev/sda > zpool list HDD1000 > zpool status HDD1000 > zfs get mountpoint,compression,encryption HDD1000 NAME PROPERTY VALUE SOURCE HDD1000 mountpoint none local HDD1000 compression off default HDD1000 encryption off default ZFS-Volumen ohne Verschlüsselung anlegen (mit Mount-Point): > zfs create -o mountpoint=/HDD1000/vol1 HDD1000/vol1 ZFS-Volumen mit Verschlüsselung anlegen (mit Mount-Point): > zfs get 2>&1 | grep -Fi encryption encryption NO YES on | off | aes-128-ccm | aes-192-ccm | aes-256-ccm | aes-128-gcm | aes-192-gcm | aes-256-gcm > zfs create -o encryption=aes-256-gcm -o keylocation=prompt -o keyformat=passphrase -o mountpoint=/HDD1000/test HDD1000/test Infos über das ZFS-Volumen anzeigen: > zfs list HDD1000/test NAME USED AVAIL REFER MOUNTPOINT HDD1000/test 98K 899G 98K /HDD1000/test > zfs get mountpoint,compression,encryption HDD1000/test NAME PROPERTY VALUE SOURCE HDD1000/test mountpoint /HDD1000/test local HDD1000/test compression off default HDD1000/test encryption aes-256-gcm - > zfs list NAME USED AVAIL REFER MOUNTPOINT HDD1000 274K 899G 24K none HDD1000/test 98K 899G 98K /HDD1000/test HDD1000/vol1 24K 899G 24K /HDD1000/vol1 ZFS-Volumen wieder löschen: > zfs destroy HDD1000/test > zfs destroy HDD1000/vol1 ZFS-Pool wieder löschen: > zpool destroy HDD1000 ===== GPT-Partitionen löschen ===== gpart destroy -F /dev/ada8 oder gpart destroy -F /dev/diskid/DISK-7IJK1ABC ===== Festplatten-Status - I/O ===== zpool iostat -v pool 5 zpool iostat -vl zpool iostat -p zpool iostat -pl zpool iostat -P zpool iostat -Pl ===== Festplatten im System finden ===== [[::freebsd:FreeBSD - Festplatten]] FreeBSD: camcontrol devlist gpart status gpart show gpart show -l gpart show -lp gpart list zpool list zpool status zfs list zfs get -s default all ===== ZFS-Snapshot ===== [[:FreeBSD:ZFS-Snapshot]] ===== automatisch mehrere Kopien von den Daten ablegen ===== # zfs get all | fgrep copies home copies 1 default # zfs set copies=2 home # zfs get allgrep copies home copies 2 local ===== Allgemeines ===== > zpool create -m none -f HDD1000 /dev/sda > zpool list > zpool status > zpool destroy HDD1000 Eine komplette Platte auf die //schnelle// mit ZFS versehen: # dd if=/dev/zero of=/dev/da4 bs=1k count=1000 # fdisk -I /dev/da4 # disklabel -w /dev/da4 # zpool create BACKUP3TB /dev/da4 # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT BACKUP3TB 2.72T 400K 2.72T 0% ONLINE - Alle gemounteten ZFS-Pool's (Container des ZFS-Dateisystems) anzeigen: # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT BACKUP3000GB 2.72T 714G 2.02T 25% ONLINE - home 1.36T 1.30T 57.0G 95% ONLINE - Alle gemounteten ZFS - on-disk's (Dateisysteme) anzeigen: # zfs list NAME USED AVAIL REFER MOUNTPOINT BACKUP3000GB 712G 1.98T 712G /BACKUP3000GB home 1.30T 38.0G 1.30T /home ZFS-SnapShot (Beispiel mit MySQL): [[http://dev.mysql.com/doc/refman/5.1/en/ha-zfs-replication.html]] alle ZFS-Tuning-Parameter anzeigen: # zfs get missing property argument usage: get [-rHp] [-d max] [-o field[,...]] [-s source[,...]] <"all" | property[,...]> [filesystem|volume|snapshot] ... The following properties are supported: PROPERTY EDIT INHERIT VALUES available NO NO compressratio NO NO <1.00x or higher if compressed> creation NO NO mounted NO NO yes | no origin NO NO referenced NO NO type NO NO filesystem | volume | snapshot used NO NO usedbychildren NO NO usedbydataset NO NO usedbyrefreservation NO NO usedbysnapshots NO NO aclinherit YES YES discard | noallow | restricted | passthrough | passthrough-x aclmode YES YES discard | groupmask | passthrough atime YES YES on | off canmount YES NO on | off | noauto casesensitivity NO YES sensitive | insensitive | mixed checksum YES YES on | off | fletcher2 | fletcher4 | sha256 compression YES YES on | off | lzjb | gzip | gzip-[1-9] copies YES YES 1 | 2 | 3 devices YES YES on | off exec YES YES on | off jailed YES YES on | off mountpoint YES YES | legacy | none nbmand YES YES on | off normalization NO YES none | formC | formD | formKC | formKD primarycache YES YES all | none | metadata quota YES NO | none readonly YES YES on | off recordsize YES YES 512 to 128k, power of 2 refquota YES NO | none refreservation YES NO | none reservation YES NO | none secondarycache YES YES all | none | metadata setuid YES YES on | off shareiscsi YES YES on | off | type= sharenfs YES YES on | off | share(1M) options sharesmb YES YES on | off | sharemgr(1M) options snapdir YES YES hidden | visible utf8only NO YES on | off version YES NO 1 | 2 | 3 | current volblocksize NO YES 512 to 128k, power of 2 volsize YES NO vscan YES YES on | off xattr YES YES on | off Sizes are specified in bytes with standard units such as K, M, G, etc. User-defined properties can be specified by using a name containing a colon (:). # zpool get all usage: get <"all" | property[,...]> ... the following properties are supported: PROPERTY EDIT VALUES available NO capacity NO guid NO health NO size NO used NO altroot YES autoreplace YES on | off bootfs YES cachefile YES | none delegation YES on | off failmode YES wait | continue | panic listsnapshots YES on | off version YES ZFS-"on-disk"-Version (Dateisystemversion) der gemounteten Pool's (ZFS-Dateisystem-Container) anzeigen: # zfs get version NAME PROPERTY VALUE SOURCE BACKUP3000GB version 3 - home version 3 - ZFS-Pool-Version (Container-Version) des "BACKUP3000GB"-Pool's anzeigen: # zpool get version BACKUP3000GB NAME PROPERTY VALUE SOURCE BACKUP3000GB version 14 default ZFS-Pool-Version (Container-Version) des "home"-Pool's anzeigen: # zpool get version home NAME PROPERTY VALUE SOURCE home version 14 default Statistik: # zpool iostat capacity operations bandwidth pool used avail read write read write ---------- ----- ----- ----- ----- ----- ----- BACKUP3000GB 712G 2.02T 4 85 567K 10.4M home 1.30T 59.7G 69 3 8.53M 26.1K ---------- ----- ----- ----- ----- ----- ----- Version der aktuellen ZFS-Installation anzeigen: # zpool upgrade This system is currently running ZFS pool version 14. All pools are formatted using this version. Version der aktuellen ZFS-Installation und alle Eigenschaften aller bisherigen ZFS-Pool-Versionen anzeigen: # zpool upgrade -v This system is currently running ZFS pool version 14. The following versions are supported: VER DESCRIPTION --- -------------------------------------------------------- 1 Initial ZFS version 2 Ditto blocks (replicated metadata) 3 Hot spares and double parity RAID-Z 4 zpool history 5 Compression using the gzip algorithm 6 bootfs pool property 7 Separate intent log devices 8 Delegated administration 9 refquota and refreservation properties 10 Cache devices 11 Improved scrub performance 12 Snapshot properties 13 snapused property 14 passthrough-x aclinherit support For more information on a particular version, including supported releases, see: http://www.opensolaris.org/os/community/zfs/version/N Where 'N' is the version number. alle ZFS-Pool's auf aktuelle Version upgraden: # zpool upgrade -a so kann man alle Laufwerke mit G-Partitionen sehen > gpart status Name Status Components ada4p1 OK ada4 ada4p2 OK ada4 ada4p3 OK ada4 diskid/DISK-03EF039300A9s1 OK diskid/DISK-03EF039300A9 da0s1 OK da0 weitere wichtige G-Infos: > gpart show > gpart list Jetzt muss der MBR neu geschrieben werden, in diesem Fall heißt die Boot-Platte "ada4" (zroot): > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada4 partcode written to ada4p1 bootcode written to ada4 Hat man einen Pool über USB angeschlossen, kann es sein, das der erste Zugriff recht lange dauert, wenn die Platten "eingeschlafen" sind. Um die Platten vor einem regelmäßigen Zugriff automatisiert (z.B. per Cron) aufzuwecken, habe ich diese Kommandozeile geschrieben. Es setzt einfach nur ein "ls" auf dem Mount-Point ab: # for mp in $(zpool list -H -o name); do zmp="$(mount|egrep "^${mp}"|awk '{print $3}')";ls ${zmp}/ >/dev/null;done #!/usr/bin/env bash VERSION="v2017071100" SKRIPTNAME="$(basename ${0})_$(date +'%F')" SKRIPTVERZEICHNIS="$(dirname ${0})" #------------------------------------------------------------------------------# if [ "$(id -u)" != "0" ] ; then echo "Sie muessen root sein!" exit 1 fi #------------------------------------------------------------------------------# if [ "$(uname -s)" = "FreeBSD" ] ; then ### FreeBSD SMARTOPT="-a" elif [ "$(uname -s)" = "Linux" ] ; then ### Linux SMARTOPT="-H" else ### Windows SMARTOPT="-h" fi #------------------------------------------------------------------------------# ( echo "================================================================================" date +'%F %T' echo "--------------------------------------------------------------------------------" for i in $(ls /dev/ad*);do smartctl -i ${i}|fgrep 'Serial Number:'|awk -v name=${i} '{print name,$NF}';done echo "--------------------------------------------------------------------------------" for ZFSPOOL in $(zpool list -H | awk '{print $1}') do for BLKGER in $(zpool status ${ZFSPOOL} | sed -ne "1,/^$/ d;/${ZFSPOOL}/,/^$/ p" | awk '{print $1}') do ls -1 /dev/${BLKGER} 2>/dev/null | while read BLKDEV do #echo "${ZFSPOOL} | ${BLKDEV} | smartctl ${SMARTOPT} ${BLKDEV}" #echo "smartctl ${SMARTOPT} ${BLKDEV}" echo -n "${ZFSPOOL} ${BLKDEV} " smartctl ${SMARTOPT} ${BLKDEV} | grep -Ei 'Device Model:|Serial Number:' | awk '{print $NF}' | tr -s '\n' '\t' | sed 's/ $//' echo done | grep -Ev '^$' done done echo echo "--------------------------------------------------------------------------------" df -h | grep -E '^/dev/' | awk '{print $1}' | grep -Fv '/md' | sed -e 's/[0-9]*$//;s/[a-z]*$//' | while read BLKGER do #echo "# ${BLKGER} | smartctl ${SMARTOPT} ${BLKGER}" echo -n "# ${BLKGER} " smartctl ${SMARTOPT} ${BLKGER} | grep -Ei 'Device Model:|Serial Number:' | awk '{print $NF}' | tr -s '\n' '\t' | sed 's/ $//' done echo "================================================================================" ) 2>&1 | tee -a /home/${SKRIPTNAME}.log ls -lha /home/${SKRIPTNAME}.log #------------------------------------------------------------------------------# FreeBSD:~# /root/bin/zfs-hdd-serial.sh ================================================================================ 2017-07-11 16:31:21 -------------------------------------------------------------------------------- /dev/ada0 WD-WCAV33097185 /dev/ada1 WD-WCC133494387 /dev/ada2 PL1331L3GG9G8H /dev/ada3 WD-WCAW33995888 /dev/ada4 WD-WCC133691187 /dev/ada5 WD-WX2137493S81 /dev/ada6 WD-WCAW33994189 /dev/ada7 PL2331L3G9908J /dev/ada8 WD-WXB13B499A8F /dev/ada9 WD-WCAZ3J498182 -------------------------------------------------------------------------------- extern01 /dev/ada7 HDS5C4040ALE630 PL2331LAGG90EJ extern01 /dev/ada4 WD4000FYYZ-01UL1B0 WD-WCC130651147 extern02 /dev/diskid/DISK-WD-WCC131404337 extern02 /dev/diskid/DISK-PL1331LAGG7GKH extern04 /dev/diskid/DISK-WD-WX21D7453SY1 extern04 /dev/ada8 WD6001FSYZ-01SS7B1 WD-WXB1HB4H9AHF home /dev/diskid/DISK-WD-WCAVY3027155 home /dev/diskid/DISK-WD-WCAZAJ471182 zroot /dev/gptid/3d5a4e6c-14c4-11e4-bc13-bcaec58cba70 zroot /dev/gptid/3f737947-14c4-11e4-bc13-bcaec58cba70 -------------------------------------------------------------------------------- ================================================================================ -rw-r--r-- 1 root wheel 1,1K 11 Juli 16:31 /home/zfs-hdd-serial.sh_2017-07-11.log ==== bootcode ==== [root@erde ~]# zpool status zroot pool: zroot state: DEGRADED status: One or more devices has been removed by the administrator. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Online the device using 'zpool online' or replace the device with 'zpool replace'. scan: resilvered 0 in 213503982334601 days 06:23:30 with 0 errors on Mon Mar 23 20:47:39 2020 config: NAME STATE READ WRITE CKSUM zroot DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 6227138898055136738 REMOVED 0 0 0 was /dev/diskid/DISK-WD-WMC6M0H02SPUp3 diskid/DISK-WD-WMC6N0H1T7LJp3 ONLINE 0 0 0 errors: No known data errors [root@erde ~]# zpool list NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT extern01 9,06T 7,72T 1,34T - - 1% 85% 1.00x ONLINE - extern02 9,06T 7,97T 1,09T - - 5% 87% 1.00x ONLINE - home 9,06T 2,14T 6,93T - - 3% 23% 1.00x ONLINE - temp 928G 304G 624G - - 0% 32% 1.00x ONLINE - zroot 920G 279G 641G - - 8% 30% 1.00x DEGRADED - [root@erde ~]# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/diskid/DISK-WD-WMC6N0H1T7LJ partcode written to diskid/DISK-WD-WMC6N0H1T7LJp1 bootcode written to diskid/DISK-WD-WMC6N0H1T7LJ ===== ein ZFS-Volumen ===== [[https://docs.oracle.com/cd/E19253-01/820-2313/gbcet/index.html]] Alle ZFS-Informationen anzeigen: # zfs get -s local all home # zfs get -s default all home # zfs get -s temporary all home # zfs get -s inherited all home # zfs get -s none all home NFS einschalten: # zfs set sharenfs=on home kontrollieren: # zfs get -s local all home NAME PROPERTY VALUE SOURCE home sharenfs on local Alle //gemounteten// ZFS-Volumen anzeigen: # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT home 1.36T 1.25T 114G 91% ONLINE - Den status aller //gemounteten// ZFS-Volumen anzeigen: # zpool status pool: home state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM home ONLINE 0 0 0 mirror ONLINE 0 0 0 ad6 ONLINE 0 0 0 ad8 ONLINE 0 0 0 errors: No known data errors Das ZFS-Volumen //BACKUP1000GB// auflösen: # zpool import BACKUP1000GB # zpool destroy BACKUP1000GB # zpool list ==== Test-Volumen auf Dateibasis anlegen ==== eine 100MB-Test-Pool-Datei erstellen > dd if=/dev/zero of=/home/zfs.img bs=10240 count=10240 einen Pool erstellen > zpool create tank /home/zfs.img verfühgbare Pools zeigen > zpool import -d /home/ Pool importieren > zpool import -d /home/ tank Pool exportieren > zpool export tank === einen ZFS-Tank aus einer Platte um eine Platte erweitern === == einen ZFS-Tank mit einer Platte erstellen == > zpool create tank1 /var/tmp/zfs1.img > zpool list tank1 NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT tank1 95,5M 92,5K 95,4M 0% 1.00x ONLINE - > zpool status tank1 pool: tank1 state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 /var/tmp/zfs1.img ONLINE 0 0 0 errors: No known data errors == mit der zweiten Platte ein RAID-0 bauen == > zpool add tank1 /var/tmp/zfs2.img > zpool list tank1 NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT tank1 191M 165K 191M 0% 1.00x ONLINE - > zpool status tank1 pool: tank1 state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 /var/tmp/zfs1.img ONLINE 0 0 0 /var/tmp/zfs2.img ONLINE 0 0 0 errors: No known data errors == den RAID-0 - Tank zerstören und mit einer Platte wieder erstellen == > zpool destroy tank1 > zpool create tank1 /var/tmp/zfs1.img > zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT tank1 95,5M 134K 95,4M 0% 1.00x ONLINE - > zpool status tank1 pool: tank1 state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 /var/tmp/zfs1.img ONLINE 0 0 0 errors: No known data errors == mit der zweiten Platte ein RAID-1 bauen == > zpool attach tank1 /var/tmp/zfs1.img /var/tmp/zfs2.img > zpool list tank1 NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT tank1 95,5M 144K 95,4M 0% 1.00x ONLINE - > zpool status tank1 pool: tank1 state: ONLINE scan: resilvered 99K in 0h0m with 0 errors on Fri Feb 21 21:48:18 2014 config: NAME STATE READ WRITE CKSUM tank1 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 /var/tmp/zfs1.img ONLINE 0 0 0 /var/tmp/zfs2.img ONLINE 0 0 0 errors: No known data errors == die zweite Platte aus dem RAID entfernen == > zpool detach tank1 /var/tmp/zfs2.img == eine defekte Platte im RAID gegen eine neue Platte austauschen == nehmen wir mal an, die Platte "zfs1.img" ist defekt und soll gegen die Platte zfs3.img" ausgetauscht werden: > zpool replace tank1 /var/tmp/zfs1.img /var/tmp/zfs3.img == einen mirror aus dem RAID entfernen == [[https://docs.oracle.com/cd/E24841_01/html/820-2313/gayrd.html|Verwalten von Datenspeichergeräten in ZFS-Speicher-Pools]] # zpool status daten ... config: NAME STATE READ WRITE CKSUM daten ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-2CKMG12J ONLINE 0 0 0 diskid/DISK-2CJPY1EN ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 diskid/DISK-3DJZ45WH ONLINE 0 0 0 diskid/DISK-3PGR457C ONLINE 0 0 0 # zpool remove daten mirror-1 # zpool status daten ... config: NAME STATE READ WRITE CKSUM daten ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-2CKMG12J ONLINE 0 0 0 diskid/DISK-2CJPY1EN ONLINE 0 0 0 ==== ZFS-Volumen auf Platte anlegen ==== === einfaches Volumen === einen Pool erstellen # zpool create BACKUP1000GB /dev/da2 verfühgbare Pools zeigen # zpool import Pool importieren # zpool import BACKUP1000GB Pool schreibgeschützt importieren # zpool import -o ro BACKUP1000GB Pool exportieren # zpool export BACKUP1000GB === RAID-1 Volumen (Spiegel) === Der einfachste "Spiegel" besteht aus 2 Platten. __In der Beschreibung von SUN steht, dass der sinnvollste Spiegen aus 3 Platten besteht, da er in dieser Konfiguration die höchste Sicherheit bietet.__ Der Sicherheitsgewinn bei 4 und mehr Platten ist zu klein um wirtschaftlich sinnvoll zu sein. einen Pool erstellen # zpool create home mirror /dev/ad6 /dev/ad8 Pool exportieren # zpool export home verfühgbare Pools zeigen # zpool import Pool importieren # zpool import home Pool schreibgeschützt importieren # zpool import -o ro home === RAID-10 Volumen === als erstes bauen wir uns einen RAID-1-Pool: # zpool create daten mirror diskid/DISK-2CKMG12J diskid/DISK-2CJPY1EN # zpool status daten ... config: NAME STATE READ WRITE CKSUM daten ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-2CKMG12J ONLINE 0 0 0 diskid/DISK-2CJPY1EN ONLINE 0 0 0 und wollen daraus nun ein RAID-10-Pool machen. Dazu binden wir zwei weitere Festplatten als Mirror zusätzlich dran: # zpool add daten mirror diskid/DISK-3DJZ45WH diskid/DISK-3PGR457C # zpool status daten ... config: NAME STATE READ WRITE CKSUM daten ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-2CKMG12J ONLINE 0 0 0 diskid/DISK-2CJPY1EN ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 diskid/DISK-3DJZ45WH ONLINE 0 0 0 diskid/DISK-3PGR457C ONLINE 0 0 0 Es ist auch möglich alles in einem einzigen Kommando machen: # zpool create daten mirror diskid/DISK-2CKMG12J diskid/DISK-2CJPY1EN mirror diskid/DISK-3DJZ45WH diskid/DISK-3PGR457C === ZFS-Volumen vergrößern === Nachdem die alten Platten in einem Pool durch neue größere ausgetauscht wurden, muß der Pool auf die Größer der neuen Festplatten angepasst werden. # zpool list home NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT home 9.06T 5.87T 3.19T - 1.81T 18% 64% 1.00x ONLINE - # zpool online -e home diskid/DISK-5QHUL123 diskid/DISK-5QHUR456 # zpool list home NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT home 10.9T 5.87T 5.01T - - 15% 53% 1.00x ONLINE - === Boot-Pool === [root@freebsd15 ~]# zpool upgrade zroot This system supports ZFS pool feature flags. Enabled the following features on 'zroot': redaction_list_spill raidz_expansion fast_dedup longname large_microzap block_cloning_endian physical_rewrite Pool 'zroot' has the bootfs property set, you might need to update the boot code. See gptzfsboot(8) and loader.efi(8) for details. [root@freebsd15 ~]# gpart show => 40 488397088 diskid/DISK-50026B76843420B6 GPT (233G) 40 1024 1 freebsd-boot (512K) 1064 984 - free - (492K) 2048 4194304 2 freebsd-swap (2.0G) 4196352 484200448 3 freebsd-zfs (231G) 488396800 328 - free - (164K) [root@freebsd15 ~]# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 diskid/DISK-50026B76843420B6 partcode written to diskid/DISK-50026B76843420B6p1 bootcode written to diskid/DISK-50026B76843420B6 [root@freebsd15 ~]# gpart status Name Status Components diskid/DISK-50026B76843420B6p1 OK diskid/DISK-50026B76843420B6 diskid/DISK-50026B76843420B6p2 OK diskid/DISK-50026B76843420B6 diskid/DISK-50026B76843420B6p3 OK diskid/DISK-50026B76843420B6 siehe auch: [[::Festplatten partitionieren#zusätzliches Laufwerk für FreeBSD 12 einrichten]] Wenn man FreeBSD 10 auf einem ZFS-Volumen (RAID1) installiert hat und nun eine Platte davon defekt ist und ausgetauscht werden muss, dann darf man nicht vergessen auch den Boot-Kode zu aktualisieren! > zpool attach zroot gptid/3f737947-14c4-11e4-bc13-bcaec58cba70 /dev/ada4 Make sure to wait until resilver is done before rebooting. If you boot from pool 'zroot', you may need to update boot code on newly attached disk '/dev/ada4'. Assuming you use GPT partitioning and 'da0' is your new boot disk you may use the following command: gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0 in unserem Fall würde das Kommando so aussehen (das funktioniert aber erst, wenn das //resilvering// abgeschlossen ist): > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 /dev/ada4 sollte es nicht funktionieren, dann mal nachschauen, ob GEOM die Platte überhaupt kennt: > glabel status Name Status Components diskid/DISK-7JJKANEC N/A ada5 gpt/swap0 N/A ada3p2 gptid/3d5a4e6c-14c4-11e4-bc13-bcaec58cba70 N/A ada3p3 diskid/DISK-PL1331LAGG7GKH N/A ada6 diskid/DISK-WD-WCAZAJ471182 N/A ada7 diskid/DISK-WD-WXB1HB4H9AHF N/A ada8 diskid/DISK-03EF039300A9 N/A da0 ntfs/Freecom N/A da0s1 gpt/gptboot0 N/A ada3p1 gptid/3cde3f3e-14c4-11e4-bc13-bcaec58cba70 N/A ada3p1 diskid/DISK-WD-WMC1T0936998 N/A ada4 gpt/zfs N/A ada4p1 gptid/2c6ef70c-d435-0d40-9c4b-6bb682066374 N/A ada4p1 gptid/a6dd9a1e-fe18-cf4c-8dd7-a7af65ad27af N/A ada4p9 sollte die Platte nicht aufgelistet werden, dann muss man die Platte nocheinmal aus dem Pool entfernen und mit diesem Kommando GEOM bekannt machen: > gpart create -s gpt ada4 jetzt kann man sie im Pool wieder aufnehmen und das //bootcode//-Kommando sollte funktionieren. > geom disk list Geom name: ada3 Providers: 1. Name: ada3 Mediasize: 1000204886016 (932G) Sectorsize: 512 Mode: r2w2e5 descr: WDC WD1003FBYZ-010FB0 lunid: 50014ee25ecb3d1b ident: WD-WCAW36974129 rotationrate: 7200 fwsectors: 63 fwheads: 16 eine boot-fähige root-Platte (ada4) für FreeBSD-10 anlegen, die dann an die bestehende root-Platte (ada3) als //mirror// (zum RAID-1) angehängt wird: > gpart show -p ada3 => 34 1953525101 ada3 GPT (932G) 34 1024 ada3p1 freebsd-boot (512K) 1058 16777216 ada3p2 freebsd-swap (8.0G) 16778274 1936746861 ada3p3 freebsd-zfs (924G) > gpart destroy -F ada4 > gpart show -l ada4 > gpart create -s gpt ada4 > gpart show -p ada4 > gpart add -t freebsd-boot -s 512K ada4 > gpart show -p ada4 > gpart add -t freebsd-swap -s 8G ada4 > gpart show -p ada4 > gpart add -t freebsd-zfs ada4 > gpart show -p ada4 beide Paltten zu einem RAID-1 zusammenfühgen: > zpool attach zroot ada3 ada4 ...warten, bis beide Platten syncronisiert sind... Boot-Kode auf die neue Platte schreiben, damit das System auch bei Ausfall der ersten Platte boot-fähig bleibt: > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4 oder so: [[https://adminforge.de/freebsd/freebsd-zfs-raid-reparieren-nach-festplattentausch/]] > gpart destroy -F ada4 > gpart backup ada3 | gpart restore ada4 > gpart show -l ada3 > gpart show -l ada4 > zpool attach zroot ada3 ada4 > zpool status > gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4 === Mount-Point === Konfiguriert man keinen speziellen Mount-Point, dann wird von ZFS automatisch ein Top-Level-Verzeichnis mit Pool-Namen angelegt ("/home"). # zpool import home ergibt das Verzeichnis: /home Will man einen speziellen mount-Point angeben, dann geht das so: ==== Beispiele ==== === Beispiel 1 === # zfs set mountpoint=/home/fritz home/fritz Hier wird das Volumen (fritz) aus dem Pool (home) als "/home/fritz" gemountet. === Beispiel aus dem Handbuch === # zfs create tank/home # zfs set mountpoint=/export/zfs tank/home # zfs set sharenfs=on tank/home # zfs set compression=on tank/home oder # zfs create -o mountpoint=/export/zfs -o sharenfs=on -o compression=on tank/home Und dann überprüfen: # zfs get mountpoint,compression tank/home === Beispiel 2 === # zfs set mountpoint=/opt tank/opt Hier wird das Volumen (opt) aus dem Pool (tank) als "/opt" gemountet. === Beispiel 3 === auf einem PC-BSD 9.1 - System: > zpool history History for 'tank0': 2013-05-19.20:51:00 zpool create -m none -f tank0 /dev/ada0s1a.nop 2013-05-19.20:51:00 zpool export tank0 2013-05-19.20:51:02 zpool import tank0 2013-05-19.20:51:02 zfs set atime=off tank0 2013-05-19.20:51:02 zfs create -p tank0/ROOT 2013-05-19.20:51:04 zfs create -p tank0/ROOT/default 2013-05-19.20:51:04 zfs set mountpoint=/mnt tank0/ROOT/default 2013-05-19.20:51:05 zpool set bootfs=tank0/ROOT/default tank0 2013-05-19.20:51:07 zfs create -V 2G -p tank0/swap 2013-05-19.20:51:07 zfs set org.freebsd:swap=on tank0/swap 2013-05-19.20:51:07 zfs set checksum=off tank0/swap 2013-05-19.20:51:09 zfs create -p tank0/root 2013-05-19.20:51:09 zfs set mountpoint=/mnt/root tank0/root 2013-05-19.20:51:11 zfs create -p tank0/tmp 2013-05-19.20:51:11 zfs set mountpoint=/mnt/tmp tank0/tmp 2013-05-19.20:51:11 zfs set compress=lzjb tank0/tmp 2013-05-19.20:51:14 zfs create -p tank0/usr 2013-05-19.20:51:14 zfs set mountpoint=/mnt/usr tank0/usr 2013-05-19.20:51:14 zfs set canmount=off tank0/usr 2013-05-19.20:51:16 zfs create -p tank0/usr/home 2013-05-19.20:51:16 zfs set mountpoint=/mnt/usr/home tank0/usr/home 2013-05-19.20:51:18 zfs create -p tank0/usr/jails 2013-05-19.20:51:18 zfs set mountpoint=/mnt/usr/jails tank0/usr/jails 2013-05-19.20:51:20 zfs create -p tank0/usr/obj 2013-05-19.20:51:21 zfs set mountpoint=/mnt/usr/obj tank0/usr/obj 2013-05-19.20:51:21 zfs set compress=lzjb tank0/usr/obj 2013-05-19.20:51:23 zfs create -p tank0/usr/pbi 2013-05-19.20:51:23 zfs set mountpoint=/mnt/usr/pbi tank0/usr/pbi ... die für uns wichtigen Befehle können wir z.B. so filtern: > zpool history | fgrep fritz > zfs create -o mountpoint=/usr/home/fritz -p tank0/usr/home/fritz > zfs destroy tank0/usr/home/fritz === Beispiel 4 (Ubuntu 14.04) === einen Pool (Tank) an einem alternativen Verzeichnis mounten zpool create -R /alternativer/mount/point tank0 /dev/sdb1 der ZFS-Treiber soll beim booten geladen werden echo "zfs" >> /etc/modules update-initramfs -u update-grub2 den Pool (Tank) generieren zpool create fritz /dev/sdb1 es ist möglich, dass man den Pool an ein anderes Verzeichnis mounten lässt: zfs set mountpoint=/home/fritz fritz man kann auf einem Pool mehrere Volumen anlegen: zfs create fritz/jobs es ist möglich, dass man das Volumen an ein anderes Verzeichnis mounten lässt: zfs set mountpoint=/home/fritz/jobs fritz/jobs chown -R fritz:nogroup /home/fritz/jobs Anzeige zpool list zpool status ===== ZFS-Datasets im Netzwerk (per NFS bzw. SMB) freigeben ===== Zwei häufig verwendete und nützliche Dataset-Eigenschaften sind die Freigabeoptionen von NFS und SMB. Diese Optionen legen fest, ob und wie ZFS-Datasets im Netzwerk freigegeben werden. __Derzeit unterstützt FreeBSD nur Freigaben von Datasets über NFS.__ * [[https://www.freebsd.org/doc/de_DE.ISO8859-1/books/handbook/zfs-zfs.html]] Für Freigaben per SMB/CIFS muss derzeit noch [[::Samba]] eingesetzt werden. ===== Reparieren von Schäden am gesamten ZFS-Speicher-Pool ===== Dokumentation auf den Seiten von SUN: - [[http://docs.oracle.com/cd/E24841_01/html/820-2313/gbbwl.html]] - [[http://docs.oracle.com/cd/E24841_01/html/820-2313/gbbve.html]] - [[http://docs.oracle.com/cd/E24841_01/html/820-2313/gbchy.html]] - [[http://docs.sun.com/app/docs/doc/820-2313/gbctt?l=de&a=view]] - [[http://dlc.sun.com/pdf/820-2313/820-2313.pdf]] am 2011-01-08 gesichert: {{::reparieren_von_schaeden_am_gesamten_zfs-speicher-pool.pdf|}} zpool status extern04 pool: extern04 state: DEGRADED status: One or more devices are faulted in response to persistent errors. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Replace the faulted device, or use 'zpool clear' to mark the device repaired. scan: none requested config: NAME STATE READ WRITE CKSUM extern04 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 ada6 FAULTED 0 7.73K 0 too many errors ada9 ONLINE 0 0 0 zpool scrub extern04 zpool status extern04 pool: extern04 state: DEGRADED status: One or more devices are faulted in response to persistent errors. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Replace the faulted device, or use 'zpool clear' to mark the device repaired. scan: scrub in progress since Tue Feb 24 23:34:22 2015 2.36G scanned out of 4.09T at 44.8M/s, 26h32m to go 0 repaired, 0.06% done config: NAME STATE READ WRITE CKSUM extern04 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 ada6 FAULTED 0 7.73K 0 too many errors ada9 ONLINE 0 0 0 ===== aus einem einfachen Pool ein RAID1 machen ===== In diesem Beispiel verwende ich an Stelle von Festplatten nur Dateien. Das ist zum testen besser geeignet. So bekommt man ein gutes Gefühl für den Vorgang und kann so eine "Trockenübung" vor dem "Ernstfall" durchgehen. Als erstes müssen wir uns die beiden Image-Dateien als Plattenersatz erstellen: # dd if=/dev/zero of=/tmp/zfs1.img bs=10240 count=10240 # dd if=/dev/zero of=/tmp/zfs2.img bs=10240 count=10240 oder so # truncate -s +100M /tmp/zfs1.img # truncate -s +100M /tmp/zfs2.img jetzt bauen wir unsere Ausgangsbasis, ein einfachen Pool: # zpool create TEST01 /tmp/zfs1.img so, das haben wir erstmal geschaft: # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT TEST01 95.5M 84K 95.4M 0% ONLINE - hier sieht man, dass es sich hier um unsere Dateien (und keine Festplatten) handelt: # zpool status pool: TEST01 state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM TEST01 ONLINE 0 0 0 /tmp/zfs1.img ONLINE 0 0 0 errors: No known data errors jetzt legen wir unsere Testdaten ab: # echo "Test 001" > /TEST01/test.txt und sie sind auch angekommen: # cat /TEST01/test.txt Test 001 hier machen wir aus unserem einfachen Pool ein RAID-1: # zpool attach TEST01 /tmp/zfs1.img /tmp/zfs2.img **Wichtig:** Die Platte mit den Daten muss als erstes (/tmp/zfs1.img) angegeben werden! und wir sehen, dass der Pool jetzt aus zwei Dateien (Platten) besteht: # zpool status pool: TEST01 state: ONLINE scrub: resilver completed after 0h0m with 0 errors on Wed Jan 19 00:49:32 2011 config: NAME STATE READ WRITE CKSUM TEST01 ONLINE 0 0 0 mirror ONLINE 0 0 0 /tmp/zfs1.img ONLINE 0 0 0 /tmp/zfs2.img ONLINE 0 0 0 96K resilvered errors: No known data errors und jetzt der finale Test, sind unsere Daten noch da? # cat /TEST01/test.txt Test 001 ... es hat geklappt, die Daten sind erhalten geblieben! ;-) ===== einen Pool vergrößern (so etwas ähnliches wie RAID0) ===== Die Vorbereitungen sehen genauso aus, wie bei dem Test mit dem RAID-1: # truncate -s +100M /tmp/zfs3.img # truncate -s +100M /tmp/zfs4.img # zpool create TEST02 /tmp/zfs3.img # echo "Test 002" > /TEST01/test.txt # cat /TEST02/test.txt Test 001 und jetzt werden die beiden Platten zusammen gesetzt, hierbei bleiben # zpool add TEST02 /tmp/zfs4.img die Daten sind noch da: # cat /TEST02/test.txt Test 001 der Pool ist jetzt doppelt so groß: # zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT TEST02 191M 150K 191M 0% 1.00x ONLINE - beide Platten sind im Pool und es ist kein Mirror: # zpool status TEST02 pool: TEST02 state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM TEST02 ONLINE 0 0 0 /tmp/zfs3.img ONLINE 0 0 0 /tmp/zfs4.img ONLINE 0 0 0 errors: No known data errors ===== spare ===== * [[https://docs.oracle.com/cd/E53394_01/html/E54801/gpegp.html]] * [[https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/gcvcw/index.html]] eine "spare" zum ganzen Pool hinzufühgen: # zpool add pool01 spare diskid/DISK-ZA23ZYXJ # zpool status pool01 ... NAME STATE READ WRITE CKSUM pool01 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-1A25NDPU ONLINE 0 0 0 diskid/DISK-2BHNABYV ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 diskid/DISK-3CHWEMHW ONLINE 0 0 0 diskid/DISK-4DGR4H7X ONLINE 0 0 0 mirror-2 ONLINE 0 0 0 diskid/DISK-5EGW976Y ONLINE 0 0 0 diskid/DISK-6FKMG95Z ONLINE 0 0 0 spares diskid/DISK-ZA23ZYXJ AVAIL errors: No known data errors Mir ist leider nicht bekannt, wie man zu einem einzelnen Mirror im Raid-10-Pool eine spare-Platte hinzufügen kann. Denn der ''mirror-0'' besteht aus 10TB-Platten, der ''mirror-1'' besteht aus 12TB-Platten der ''mirror-2'' besteht aus 16TB-Platten. Die spare-Platte ist aber auch nur 10TB groß... Demnach macht eine Spare für den kompletten Pool keinen Sinn. # zpool list pool01 NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT pool01 34.5T 28.6T 5.93T - - 4% 82% 1.00x ONLINE - ==== defekte Platte durch spare ersetzen ==== # zpool status pool01 ... NAME STATE READ WRITE CKSUM pool01 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 diskid/DISK-1A25NDPU ONLINE 0 0 0 diskid/DISK-2BHNABYV REMOVED 0 0 0 mirror-1 ONLINE 0 0 0 diskid/DISK-3CHWEMHW ONLINE 0 0 0 diskid/DISK-4DGR4H7X ONLINE 0 0 0 mirror-2 ONLINE 0 0 0 diskid/DISK-5EGW976Y ONLINE 0 0 0 diskid/DISK-6FKMG95Z ONLINE 0 0 0 spares diskid/DISK-ZA23ZYXJ AVAIL errors: No known data errors so wird die defekte Platte durch die Spare-Platte ausgetauscht: # zpool replace daten diskid/DISK-2BHNABYV diskid/DISK-ZA23ZYXJ ... NAME STATE READ WRITE CKSUM pool01 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 diskid/DISK-1A25NDPU ONLINE 0 0 0 spare-1 ONLINE 0 0 0 diskid/DISK-2BHNABYV ONLINE 0 0 0 diskid/DISK-ZA23ZYXJ ONLINE 0 0 0 (resilvering) mirror-1 ONLINE 0 0 0 diskid/DISK-3CHWEMHW ONLINE 0 0 0 diskid/DISK-4DGR4H7X ONLINE 0 0 0 mirror-2 ONLINE 0 0 0 diskid/DISK-5EGW976Y ONLINE 0 0 0 diskid/DISK-6FKMG95Z ONLINE 0 0 0 spares diskid/DISK-ZA23ZYXJ INUSE currently in use ===== ZFS-Probleme ===== ==== ZFS: checksum mismatch ==== Das Problem sieht in der Logdatei wie folgt aus: Mar 31 23:30:50 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=297610772480 size=131072 Mar 31 23:30:50 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=297610772480 size=131072 Mar 31 23:30:50 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 Mar 31 23:31:20 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=23159373824 size=131072 Mar 31 23:31:20 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=23159373824 size=131072 Mar 31 23:31:20 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 Mar 31 23:31:34 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=18063163392 size=131072 Mar 31 23:31:34 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=18063163392 size=131072 Mar 31 23:31:34 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 Mar 31 23:31:34 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=18062901248 size=131072 Mar 31 23:31:34 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=18062901248 size=131072 Mar 31 23:31:34 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 Mar 31 23:31:35 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=17453809664 size=131072 Mar 31 23:31:35 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=17453809664 size=131072 Mar 31 23:31:35 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 Mar 31 23:31:35 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=17453809664 size=131072 Mar 31 23:31:35 plebeian root: ZFS: checksum mismatch, zpool=storage path=/dev/ad4s1d.eli offset=17453809664 size=131072 Mar 31 23:31:35 plebeian root: ZFS: zpool I/O failure, zpool=storage error=86 * [[http://lists.freebsd.org/pipermail/freebsd-current/2009-April/005795.html|eine Lösung]] # sysctl kern.smp.disabled=1 ==== zpool device UNAVAIL ==== Problem anzeigen: [root@server ~]# zpool status -v extern03 pool: extern03 state: DEGRADED status: One or more devices could not be opened. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Attach the missing device and online it using 'zpool online'. see: http://illumos.org/msg/ZFS-8000-2Q scan: scrub in progress since Sun Feb 2 21:35:35 2014 1,89T scanned out of 2,79T at 50,5M/s, 5h10m to go 0 repaired, 67,85% done config: NAME STATE READ WRITE CKSUM extern03 DEGRADED 0 0 0 mirror-0 DEGRADED 0 0 0 da1 ONLINE 0 0 0 17785732228181994288 UNAVAIL 0 0 0 was /dev/da3 errors: No known data errors Laufwerk wieder online nehmen: [root@server ~]# zpool online extern03 17785732228181994288 wenn das nicht funktioniert, dann Laufwerk entfernen: [root@server ~]# zpool detach extern03 17785732228181994288 Laufwerk wieder anfühgen: [root@server ~]# zpool attach extern03 /dev/da1 /dev/da2 jetzt wird der Spiegel wieder hergestellt: [root@server ~]# zpool status -v extern03 pool: extern03 state: ONLINE status: One or more devices is currently being resilvered. The pool will continue to function, possibly in a degraded state. action: Wait for the resilver to complete. scan: resilver in progress since Mon Feb 3 08:36:50 2014 59,5M scanned out of 2,79T at 2,29M/s, 355h0m to go 59,2M resilvered, 0,00% done config: NAME STATE READ WRITE CKSUM extern03 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 da1 ONLINE 0 0 0 da2 ONLINE 0 0 0 (resilvering) errors: No known data errors ...das dauert jetzt eine Weile... ...und wenn es fertig ist, können wir den Fehlerspeicher löschen: > zpool clear extern03 und so sieht es dann wieder wie neu aus: > zpool status extern03 pool: extern03 state: ONLINE scan: resilvered 220K in 0h0m with 0 errors on Tue Feb 4 10:10:25 2014 config: NAME STATE READ WRITE CKSUM extern03 ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 da1 ONLINE 0 0 0 da2 ONLINE 0 0 0 errors: No known data errors ===== ZFS Tuning ===== * [[http://www.oracle.com/technetwork/indexes/documentation/index.html]] * [[http://www.freebsd.org/doc/de/books/handbook/book.html#FILESYSTEMS-ZFS|FreeBSD-Handbuch: Das Z-Dateisystem (ZFS)]] * [[http://wiki.freebsd.org/ZFSTuningGuide]] * [[http://www.solarisinternals.com/wiki/index.php/ZFS_Evil_Tuning_Guide#Tuning_is_Evil]] **Tuning is Evil** Tuning is often evil and should rarely be done. First, consider that the default values are set by the people who know the most about the effects of the tuning on the software that they supply. If a better value exists, it should be the default. While alternative values might help a given workload, it could quite possibly degrade some other aspects of performance. Occasionally, catastrophically so. interessante Optionen: * "**''compression:''**" der Speicherplatzbedarf sinkt dramatisch, ebenso sinkt die Datensicherheit; * "**''deduplication:''**" der Speicherplatzbedarf sinkt nur leicht (2-5GB bei 1TB) und die Geschwindigkeit sinkt ebenfalls; ===== Trivial ===== Die Speicherung oder Übertragung einer Informationseinheit (z. B. ein Bit) ist an die Speicherung oder Übertragung von Energie gekoppelt, da Information ohne ein Medium nicht existieren kann, d. h. Information ist an die Existenz unterscheidbarer Zustände gekoppelt. Da die Energie Quantisiert ist (es eine aller kleinste unteilbare Energiemenge gibt), ist eine Mindestmenge von Energie pro Informationseinheit notwendig, sonst geht die Information verloren. Um einen Speicherpool mit 128-Bit-Adressierung zu füllen, wäre eine Energiemenge notwendig, die größer ist als die Menge an Energie, die ausreichen würde, um die irdischen Ozeane zu verdampfen. Deshalb geht man davon aus, dass die Kapazität von ZFS //für immer// ausreichen wird. ===== Probleme / Fehler ===== Aug 2 07:09:23 freebsd12 kernel: ahcich5: Timeout on slot 20 port 0 Aug 2 07:09:23 freebsd12 kernel: ahcich5: is 00000000 cs 00000000 ss 00000000 rs 00100000 tfd 50 serr 00000000 cmd 00711417 Scheinbar funktionieren [[::FreeBSD:FreeBSD#ZFS + Marvell-Controller]] nicht so gut zusammen! Nachdem ich diesen SATA-Controller mit Marvell-Chipsatz aus dem System entfernt hatte, war das Problem behoben. ===== veraltete ZFS-Boot-Environments entfernen ===== Um veraltete ZFS Boot-Environments (BEs) zu bereinigen, kannst du das bectl (Boot Environment Control) Tool verwenden. NAME USED AVAIL REFER MOUNTPOINT ... zroot/ROOT/13.2-RELEASE-p2_2023-10-01_000223 8K 50.4G 47.7G / zroot/ROOT/13.2-RELEASE-p3_2023-10-05_224449 8K 50.4G 51.1G / zroot/ROOT/13.2-RELEASE-p4_2024-02-09_215133 8K 50.4G 63.7G / zroot/ROOT/13.2-RELEASE-p9_2024-02-09_221758 8K 50.4G 63.7G / zroot/ROOT/14.0-RELEASE-p11_2024-10-20_004826 8K 50.4G 73.8G / zroot/ROOT/14.0-RELEASE-p11_2024-10-20_032728 8K 50.4G 73.8G / zroot/ROOT/14.0-RELEASE-p11_2024-10-20_114546 8K 50.4G 75.5G / zroot/ROOT/14.0-RELEASE-p5_2024-10-20_001720 8K 50.4G 79.6G / zroot/ROOT/14.1-RELEASE-p5_2024-10-20_115154 8K 50.4G 75.6G / zroot/ROOT/14.1-RELEASE-p5_2024-12-23_221120 8K 50.4G 82.6G / zroot/ROOT/14.1-RELEASE-p6_2024-12-24_000858 8K 50.4G 83.7G / zroot/ROOT/14.2-RELEASE-p2_2025-03-18_192014 8K 50.4G 81.4G / zroot/ROOT/14.2-RELEASE-p2_2025-08-09_013852 8K 50.4G 90.1G / zroot/ROOT/14.2-RELEASE-p5_2025-08-09_142010 8K 50.4G 92.6G / zroot/ROOT/14.2-RELEASE_2024-12-24_033100 8K 50.4G 83.8G / zroot/ROOT/14.2-RELEASE_2025-03-18_095706 8K 50.4G 81.5G / zroot/ROOT/14.3-RELEASE-p2_2025-08-09_162348 8K 50.4G 89.0G / zroot/ROOT/14.3-RELEASE-p2_2025-08-09_163646 8K 50.4G 89.0G / BE Active Mountpoint Space Created 13.2-RELEASE-p2_2023-10-01_000223 - - 4.46G 2023-10-01 00:02 13.2-RELEASE-p3_2023-10-05_224449 - - 7.46G 2023-10-05 22:44 13.2-RELEASE-p4_2024-02-09_215133 - - 184M 2024-02-09 21:51 13.2-RELEASE-p9_2024-02-09_221758 - - 174M 2024-02-09 22:17 14.0-RELEASE-p11_2024-10-20_004826 - - 376M 2024-10-20 00:48 14.0-RELEASE-p11_2024-10-20_032728 - - 113M 2024-10-20 03:27 14.0-RELEASE-p11_2024-10-20_114546 - - 3.07M 2024-10-20 11:45 14.0-RELEASE-p5_2024-10-20_001720 - - 6.94G 2024-10-20 00:17 14.1-RELEASE-p5_2024-10-20_115154 - - 4.46M 2024-10-20 11:51 14.1-RELEASE-p5_2024-12-23_221120 - - 110M 2024-12-23 22:11 14.1-RELEASE-p6_2024-12-24_000858 - - 3.32M 2024-12-24 00:08 14.2-RELEASE-p2_2025-03-18_192014 - - 1.61G 2025-03-18 19:20 14.2-RELEASE-p2_2025-08-09_013852 - - 2.10G 2025-08-09 01:38 14.2-RELEASE-p5_2025-08-09_142010 - - 10.9M 2025-08-09 14:20 14.2-RELEASE_2024-12-24_033100 - - 1.94G 2024-12-24 03:31 14.2-RELEASE_2025-03-18_095706 - - 1.95G 2025-03-18 09:57 14.3-RELEASE-p2_2025-08-09_162348 - - 291M 2025-08-09 16:23 14.3-RELEASE-p2_2025-08-09_163646 - - 6.77M 2025-08-09 16:36 default NR / 166G 2022-05-21 16:51 bectl destroy 14.0-RELEASE-p11_2024-10-20_004826 bectl destroy 14.0-RELEASE-p11_2024-10-20_032728 bectl destroy 14.0-RELEASE-p11_2024-10-20_114546 bectl destroy 14.0-RELEASE-p5_2024-10-20_001720