ZFS cheatsheet
- Wichtige ZFS-Patches: 127729-07 (x86) / 127728-06 (SPARC)
- ZFS Best Practices Guide http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
- ZFS FAQ bei Opensolaris.org http://www.opensolaris.org/os/community/zfs/faq/
ZFS Tuning
Eine gefühlte Langsamkeit auf Systemen mit ZFS kommt vom sehr großen Cachehunger. Den kann man eingrenzen: Erstmal schauen, was phase ist:
lollypop@wirefall:~# echo "::kmastat ! grep Total" |mdb -k Total [hat_memload] 13508608B 309323764 0 Total [kmem_msb] 24010752B 1509706 0 Total [kmem_va] 660340736B 140448 0 Total [kmem_default] 690409472B 1416078794 0 Total [kmem_io_64G] 34619392B 8456 0 Total [kmem_io_4G] 16384B 92 0 Total [kmem_io_2G] 24576B 62 0 Total [bp_map] 1048576B 234488 0 Total [umem_np] 786432B 976 0 Total [id32] 4096B 2620 0 Total [zfs_file_data_buf] 1471275008B 1326646 0 Total [segkp] 589824B 192886 0 Total [ip_minor_arena_sa] 64B 13332 0 Total [ip_minor_arena_la] 192B 45183 0 Total [spdsock] 64B 1 0 Total [namefs_inodes] 64B 24 0 lollypop@wirefall:~# echo "::memstat" | mdb -k Page Summary Pages MB %Tot ------------ ---------------- ---------------- ---- Kernel 255013 996 24% ZFS File Data 359196 1403 34% Anon 346538 1353 33% Exec and libs 33948 132 3% Page cache 4836 18 0% Free (cachelist) 22086 86 2% Free (freelist) 23420 91 2% Total 1045037 4082 Physical 1045036 4082
Oder nur ZFS
echo "::memstat ! egrep '(Page Summary|-----|ZFS)'"| mdb -k
Ausgeben aller ARC-Parameter:
lollypop@wirefall:~# echo "::arc -m" | mdb -k hits = 80839319 misses = 3717788 demand_data_hits = 4127150 demand_data_misses = 51589 demand_metadata_hits = 9467792 demand_metadata_misses = 2125852 prefetch_data_hits = 127941 prefetch_data_misses = 596238 prefetch_metadata_hits = 67116436 prefetch_metadata_misses = 944109 mru_hits = 2031248 mru_ghost_hits = 1906199 mfu_hits = 78514880 mfu_ghost_hits = 993236 deleted = 880714 recycle_miss = 1381210 mutex_miss = 197 evict_skip = 38573528 evict_l2_cached = 0 evict_l2_eligible = 94658370048 evict_l2_ineligible = 8946457600 hash_elements = 79571 hash_elements_max = 82328 hash_collisions = 3005774 hash_chains = 22460 hash_chain_max = 8 p = 64 MB c = 512 MB c_min = 127 MB c_max = 512 MB size = 512 MB hdr_size = 14825736 data_size = 468982784 other_size = 53480992 l2_hits = 0 l2_misses = 0 l2_feeds = 0 l2_rw_clash = 0 l2_read_bytes = 0 l2_write_bytes = 0 l2_writes_sent = 0 l2_writes_done = 0 l2_writes_error = 0 l2_writes_hdr_miss = 0 l2_evict_lock_retry = 0 l2_evict_reading = 0 l2_free_on_write = 0 l2_abort_lowmem = 0 l2_cksum_bad = 0 l2_io_error = 0 l2_size = 0 l2_hdr_size = 0 memory_throttle_count = 0 arc_no_grow = 0 arc_tempreserve = 0 MB arc_meta_used = 150 MB arc_meta_limit = 128 MB arc_meta_max = 313 MB
Man kann sich auch alle Parameter ausgeben lassen, die für ZFS gesetzt sind mit:
# echo ::zfs_params | mdb -k arc_reduce_dnlc_percent = 0x3 zfs_arc_max = 0x100000000 zfs_arc_min = 0x0 arc_shrink_shift = 0x5 zfs_mdcomp_disable = 0x0 zfs_prefetch_disable = 0x0 zfetch_max_streams = 0x8 zfetch_min_sec_reap = 0x2 zfetch_block_cap = 0x100 zfetch_array_rd_sz = 0x100000 zfs_default_bs = 0x9 zfs_default_ibs = 0xe ... # echo "::arc -a" | mdb -k hits = 592730 misses = 5095 demand_data_hits = 0 demand_data_misses = 0 demand_metadata_hits = 592719 demand_metadata_misses = 4866 prefetch_data_hits = 0 prefetch_data_misses = 0 ...
Setzen von Kernelparametern geht auch online mit:
# echo zfs_arc_max/Z100000000 | mdb -kw zfs_arc_max: <old value> = 0x100000000
Das setzt den zfs_arc_max auf 4GB = 0x100000000
Limitieren des ARC Cache
In der /etc/system einfach: set zfs:zfs_arc_max = <Number of bytes>
Siehe auch Limiting the ARC Cache
ZFS Platzverbrauch besser anzeigen
$ zfs list -o space NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD rpool 25.4G 7.79G 0 64K 0 7.79G rpool/ROOT 25.4G 6.29G 0 18K 0 6.29G rpool/ROOT/snv_98 25.4G 6.29G 0 6.29G 0 0 rpool/dump 25.4G 1.00G 0 1.00G 0 0 rpool/export 25.4G 38K 0 20K 0 18K rpool/export/home 25.4G 18K 0 18K 0 0 rpool/swap 25.8G 512M 0 111M 401M 0
Wenn zfs list -o space als shortcut noch nicht zur Verfügung steht, geht meist:
$ zfs list -o name,avail,used,usedsnap,usedds,usedrefreserv,usedchild -t filesystem,volume
Migration UFS-Root -> ZFS-Root via Live-Upgrade
Erstmal den ZFS Rootpool anlegen:
# zpool create rpool /dev/dsk/<disk>
Wer Problemen aus dem Weg gehen möchte, läßt den Namen bei rpool.
Boot-Environment (BE) mit lucreate erstellen
# lucreate -c ufsBE -n zfsBE -p rpool
Hiermit werden die Files in die ZFS-Umgebung kopiert.
Prüfen, ob das BootFS richtig gesetzt wurde:
# zpool get bootfs rpool NAME PROPERTY VALUE SOURCE rpool bootfs rpool/ROOT/zfsBE local
Auskommentieren von eventuell noch nachgebliebenen rootdev-Einträgen in der /etc/system
# zpool export rpool # zpool import -R /tmp/rpool rpool # zfs unmount rpool # rmdir /tmp/rpool/rpool # zfs mount rpool/ROOT/zfsBE # perl -pi.orig -e 's#^(rootdev.*)$#* \1#g' /tmp/rpool/etc/system # zpool export rpool
Aktivieren des neuen BEs
# luactivate zfsBE