<?xml version="1.0" encoding="utf-8" ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:tt="http://teletype.in/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"><title>In Linux Find Truth</title><subtitle>Blogging about Linux &amp; Other Things</subtitle><author><name>In Linux Find Truth</name></author><id>https://teletype.in/atom/datapioneer</id><link rel="self" type="application/atom+xml" href="https://teletype.in/atom/datapioneer?offset=0"></link><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><link rel="next" type="application/rss+xml" href="https://teletype.in/atom/datapioneer?offset=10"></link><link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></link><updated>2026-04-11T14:44:07.545Z</updated><entry><id>datapioneer:BJFUzIIkU</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/BJFUzIIkU?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Zettabyte File System Explained</title><published>2019-12-29T19:54:49.370Z</published><updated>2020-01-03T17:18:16.191Z</updated><category term="blog" label="Blog"></category><summary type="html">In this article, I will strive to answer many questions that have been asked about ZFS, such as what is it, why should I use it, what can I do with it, and the like? Let's begin:</summary><content type="html">
  &lt;p&gt;In this article, I will strive to answer many questions that have been asked about ZFS, such as what is it, why should I use it, what can I do with it, and the like? Let&amp;#x27;s begin:&lt;/p&gt;
  &lt;h3&gt;What are some of the attributes of ZFS?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS is a fully-featured filesystem&lt;/li&gt;
    &lt;li&gt;Does data integrity checking&lt;/li&gt;
    &lt;li&gt;Uses snapshots&lt;/li&gt;
    &lt;li&gt;Created by Sun Microsystems, forked by Oracle&lt;/li&gt;
    &lt;li&gt;Oracle version is less full featured&lt;/li&gt;
    &lt;li&gt;OpenZFS - open source version of ZFS&lt;/li&gt;
    &lt;li&gt;Feeds into FreeBSD, illumos, ZFSonLinux, Canonical&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;What makes ZFS special?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Leverages well-understood standard userland tools into the filesystem&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;Checksums everything&lt;/li&gt;
      &lt;li&gt;Metadata abounds&lt;/li&gt;
      &lt;li&gt;Uses Compression&lt;/li&gt;
      &lt;li&gt;diff(1)&lt;/li&gt;
      &lt;li&gt;Copy-on-Write (COW)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
  &lt;h3&gt;What is Copy-on-Write?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS never changes a written disk sector&lt;/li&gt;
    &lt;li&gt;A sector changes? Allocate a new sector. Write data to it&lt;/li&gt;
    &lt;li&gt;Data on disk is always coherent&lt;/li&gt;
    &lt;li&gt;Power loss half-way through a write? Old data is still there untouched. Version control at the disk level&lt;/li&gt;
    &lt;li&gt;Interesting side-effect. You can effectively free snapshots&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;ZFS Assumptions?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS is not your typical EXT/UFS filesystem&lt;/li&gt;
    &lt;li&gt;Traditional assumptions about filesystems will come back to haunt you&lt;/li&gt;
    &lt;li&gt;Non-ZFS tools like &lt;strong&gt;&lt;em&gt;dump&lt;/em&gt;&lt;/strong&gt; will &lt;em&gt;appear&lt;/em&gt; to work, but not really&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;ZFS Hardware?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;RAID Controllers -- Absolutely NOT!&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;ZFS expects raw disk access&lt;/li&gt;
      &lt;li&gt;RAID controller in JBOD or single-disk RAID0?&lt;/li&gt;
      &lt;li&gt;RAM -- ECC?&lt;/li&gt;
      &lt;li&gt;Disk redundancy&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
  &lt;h3&gt;ZFS Terminology&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;VDEV or Virtual Device - a group of storage providers&lt;/li&gt;
    &lt;li&gt;Pool - a group of identical VDEVs&lt;/li&gt;
    &lt;li&gt;Dataset - a named chunk of data on a pool&lt;/li&gt;
    &lt;li&gt;You can arrange data in a pool anyway that you desire&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;-f&lt;/strong&gt; switch is very important (be careful how you use it)&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Virtual Devices (VDEVs) and Pools&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Basic unit of storage in ZFS&lt;/li&gt;
    &lt;li&gt;All ZFS redundancy occurs at the virtual device level&lt;/li&gt;
    &lt;li&gt;Can be built out of any storage provider&lt;/li&gt;
    &lt;li&gt;Most common providers: disk or GPT partition&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;Could be FreeBSD crypto device&lt;/li&gt;
      &lt;li&gt;Low-Level Virtual Machine (LLVM) RAID&lt;/li&gt;
    &lt;/ul&gt;
    &lt;li&gt;A Pool contains only one type of VDEV&lt;/li&gt;
    &lt;li&gt;&amp;quot;X VDEV&amp;quot; and &amp;quot;X Pool&amp;quot; get used interchangeably&lt;/li&gt;
    &lt;li&gt;VDEVs are added to Pools&lt;/li&gt;
    &lt;li&gt;Typically providers are not added to VDEVs but to Pools&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Stripe VDEV/Pool&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Each disk is its own VDEV&lt;/li&gt;
    &lt;li&gt;Data is striped across all VDEVs in the Pool&lt;/li&gt;
    &lt;li&gt;Can add striped VDEVs to grow Pools&lt;/li&gt;
    &lt;li&gt;No redundancy. Absolutely none. Nada!&lt;/li&gt;
    &lt;li&gt;No self-healing&lt;/li&gt;
    &lt;li&gt;Set &lt;em&gt;copies=2&lt;/em&gt; to get self-healing; Must be done when added&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Mirror VDEV/Pool&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Each VDEV contains multiple disks that replicate the data of all other disks in the VDEV&lt;/li&gt;
    &lt;li&gt;A Pool with multiple VDEVS is synonymous to RAID-10 (Stripe over Mirrors)&lt;/li&gt;
    &lt;li&gt;Can add more mirror VDEVs to grow Pool&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;RAIDZ VDEV/Pool&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Each VDEV contains multiple disks&lt;/li&gt;
    &lt;li&gt;Data integrity maintained via parity (such as RAID-5, etc.)&lt;/li&gt;
    &lt;li&gt;Lose a disk - No data loss&lt;/li&gt;
    &lt;li&gt;Can self-heal via redundant checksums&lt;/li&gt;
    &lt;li&gt;RAIDZ Pool can have multiple identical VDEVs&lt;/li&gt;
    &lt;li&gt;Cannot expand the size of a RAIDZ VDEV by adding more disks&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;RAIDZ Types&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;RAID-Z1&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;3+ Disks&lt;/li&gt;
      &lt;li&gt;Can lose 1 disk/VDEV&lt;/li&gt;
    &lt;/ul&gt;
    &lt;li&gt;RAID-Z2&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;4 + Disks&lt;/li&gt;
      &lt;li&gt;Can lose 2 disks/VDEV&lt;/li&gt;
    &lt;/ul&gt;
    &lt;li&gt;RAID-Z3&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;5+ Disks&lt;/li&gt;
      &lt;li&gt;Can lose 3 disks/VDEV&lt;/li&gt;
    &lt;/ul&gt;
    &lt;li&gt;Disk size far exceeds disk access speed&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Number of Disks and Pools?&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;No more than 9 - 12 Disks per VDEV&lt;/li&gt;
    &lt;li&gt;Pool size is your choice&lt;/li&gt;
    &lt;li&gt;Avoid putting everything in one massive Pool&lt;/li&gt;
    &lt;li&gt;Best practice is to put OS in one mirrored Pool, and data in a separate Pool&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;RAIDZ vs. Traditional RAID&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS combines filesystem and Volume Manager - faster recovery&lt;/li&gt;
    &lt;li&gt;Write hole&lt;/li&gt;
    &lt;li&gt;Copy-on-Write -- never modify a block, only write new blocks&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Create Striped Pools&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Each VDEV is a single disk&lt;/li&gt;
    &lt;li&gt;No special label for VDEV of striped disk&lt;/li&gt;
    &lt;li&gt;# zpool create trinity gpt/zfs0 gpt/zfs1 \ gpt/zfs2 gpt/zfs3 gpt/zfs4&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Viewing Stripe/Mirror/RAIDZ Pool Results&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Use # zpool status&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Multi-VDEV RAIDZ&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Stripes are inherently multi-VDEV&lt;/li&gt;
    &lt;li&gt;There&amp;#x27;s no traditional RAID equivalent&lt;/li&gt;
    &lt;li&gt;Use &lt;em&gt;type&lt;/em&gt; keyword multiple times&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;# zpool create trinity &lt;strong&gt;raidz1&lt;/strong&gt; gpt/zfs0 gpt/zfs1 gpt/zfs2 &lt;strong&gt;raidz1&lt;/strong&gt; gpt/zfs3 gpt/zfs4 gpt/zfs5&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Malformed Pool Example&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zpool create trinity &lt;strong&gt;raidz1&lt;/strong&gt; gpt/zfs0 gpt/zfs1 gpt/zfs2 &lt;strong&gt;mirror&lt;/strong&gt; gpt/zfs3 gpt/zfs4 gpt/zfs5&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;receives an &amp;quot;invalid vdev specification&amp;quot; message&lt;/li&gt;
    &lt;/ul&gt;
    &lt;li&gt;Don&amp;#x27;t use &lt;strong&gt;-f&lt;/strong&gt; here as ZFS will let you when you shouldn&amp;#x27;t&lt;/li&gt;
    &lt;li&gt;Attempting to add a Striped Mirror to a RAIDz -- No go!&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Reusing Providers&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zpool create db gpt/zfs1 gpt/zfs2 gpt/zfs3 gpt/zfs4&lt;/li&gt;
    &lt;li&gt;/dev/gpt/zfs3 is a part of an exported pool &amp;#x27;db&amp;#x27; , so&lt;/li&gt;
    &lt;li&gt;the use of &lt;strong&gt;-f&lt;/strong&gt; here is appropriate and essential&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Pool Integrity&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS is self-healing at the Pool and VDEV level&lt;/li&gt;
    &lt;li&gt;Parity allows data to be rebuilt&lt;/li&gt;
    &lt;li&gt;Every block is hashed; hash is stored in the parent&lt;/li&gt;
    &lt;li&gt;Data integrity is checked as the data is accessed on the disk&lt;/li&gt;
    &lt;li&gt;A &lt;strong&gt;Scrub&lt;/strong&gt; is essentially checking the live filesystem without off-line&amp;#x27;ing&lt;/li&gt;
    &lt;li&gt;If you don&amp;#x27;t have VDEV redundancy, use dataset &lt;em&gt;copies&lt;/em&gt; property&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Scrub vs fsck&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS has no offline integrity checker&lt;/li&gt;
    &lt;li&gt;ZFS scrub does everything that fsck does, and more&lt;/li&gt;
    &lt;li&gt;You can offline your Pool to scrub, by why would you?&lt;/li&gt;
    &lt;li&gt;Scrub isn&amp;#x27;t perfect, but it&amp;#x27;s better than fsck&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Pool Properties&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Properties are tunables&lt;/li&gt;
    &lt;li&gt;Both Pools and Datasets have properties&lt;/li&gt;
    &lt;li&gt;Commands: &lt;em&gt;zpool set&lt;/em&gt;, and &lt;em&gt;zpool get&lt;/em&gt;&lt;/li&gt;
    &lt;li&gt;Some are read-only&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;# zpool get all | less&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Changing Pool Properties&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zpool set comment=&amp;quot;Main OS Files&amp;quot; zroot&lt;/li&gt;
    &lt;li&gt;# zpool set copies=2 zroot&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Pool History&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zpool history zroot&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;ZPool Feature Flags&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS had version numbers&lt;/li&gt;
    &lt;li&gt;Then, Oracle assimilated Sun&lt;/li&gt;
    &lt;li&gt;Feature flags are at version 5000&lt;/li&gt;
    &lt;li&gt;Feature flags versus OS&lt;/li&gt;
    &lt;li&gt;# zpool get all trinity | grep feature&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Datasets&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;A named chunk of data&lt;/li&gt;
    &lt;li&gt;Filesystems&lt;/li&gt;
    &lt;li&gt;Volume&lt;/li&gt;
    &lt;li&gt;Snapshot&lt;/li&gt;
    &lt;li&gt;Clone&lt;/li&gt;
    &lt;li&gt;Bookmark&lt;/li&gt;
    &lt;li&gt;Properties and features work on a per-dataset basis&lt;/li&gt;
    &lt;li&gt;# zfs list -r zroot/ROOT&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Creating Datasets&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;$ zfs create zroot/var/mysql&lt;/li&gt;
    &lt;li&gt;$ zfs create -V 4G zroot/vmware&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Destroying Datasets&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zfs destroy zroot/var/old-mysql&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;-v&lt;/strong&gt; -- verbose mode&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;-n&lt;/strong&gt; -- no-op flag&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Parent-Child Relationships&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Datasets inherit their parent&amp;#x27;s properties&lt;/li&gt;
    &lt;li&gt;If you change it locally, but want to have it use the parent&amp;#x27;s inherited property, use &lt;/li&gt;
  &lt;/ul&gt;
  &lt;p&gt;     &lt;em&gt;zfs inherit&lt;/em&gt;&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;Renaming a Dataset changes its inheritance&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Pool Repair &amp;amp; Maintenance&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Resilvering&lt;/li&gt;
    &lt;li&gt;Rebuild from parity&lt;/li&gt;
    &lt;li&gt;Uses VDEV redundancy data&lt;/li&gt;
    &lt;li&gt;No redundancy? No resilvering&lt;/li&gt;
    &lt;li&gt;Throttled by Disk I/O&lt;/li&gt;
    &lt;li&gt;Happens automatically when disk is replaced&lt;/li&gt;
    &lt;li&gt;Can add VDEVs to Pools, not disks to VDEV&lt;/li&gt;
    &lt;li&gt;Be cautious of slightly smaller disks (check sector size as they can vary from disk to disk of equal capacity)&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Add VDEV to Pool&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;New VDEVs must be identical to existing VDEVs in the Pool&lt;/li&gt;
    &lt;ul&gt;
      &lt;li&gt;# zpool add scratch gpt/zfs99&lt;/li&gt;
      &lt;li&gt;# zpool add db mirror gpt/zfs6 gpt/zfs7&lt;/li&gt;
      &lt;li&gt;# zpool add trinity raidz1 gpt/zfs3 gpt/zfs4 gpt/zfs5&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Hardware States in ZFS&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ONLINE -- operating normally&lt;/li&gt;
    &lt;li&gt;DEGRADED -- at least one storage provider has failed&lt;/li&gt;
    &lt;li&gt;FAULTED -- generated too many errors&lt;/li&gt;
    &lt;li&gt;UNAVAIL -- cannot open storage provider&lt;/li&gt;
    &lt;li&gt;OFFLINE -- storage provider has been shut down&lt;/li&gt;
    &lt;li&gt;REMOVED -- hardware detection of unplugged device&lt;/li&gt;
    &lt;li&gt;Errors percolate up through the ZFS stack&lt;/li&gt;
    &lt;li&gt;Hardware RAID hides errors - ZFS does not!&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Log and Cache Devices&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Read Cache -- L2ARC (Level 2 Adaptive Replacement Cache)&lt;/li&gt;
    &lt;li&gt;Synchronous Write Log -- ZIL, SLOG (ZFS Intent Log, Separate Log Device)&lt;/li&gt;
    &lt;li&gt;Where is the bottleneck?&lt;/li&gt;
    &lt;li&gt;Log/Cache Hardware&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Filesystem Compression&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Compression exchanges CPU time for disk I/O&lt;/li&gt;
    &lt;li&gt;Disk I/O is very limited&lt;/li&gt;
    &lt;li&gt;CPU time is plentiful&lt;/li&gt;
    &lt;li&gt;LZ4 by default&lt;/li&gt;
    &lt;li&gt;Enable compression before writing any data&lt;/li&gt;
    &lt;li&gt;# set compress=lz4 zroot&lt;/li&gt;
    &lt;li&gt;Typically gzip-9 is better than lz4&lt;/li&gt;
    &lt;li&gt;No more userland log compression&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Memory Cache Compression&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Advanced Replication Cache is ZFS&amp;#x27; Buffer Cache&lt;/li&gt;
    &lt;li&gt;ARC compression exchanges CPU time for memory&lt;/li&gt;
    &lt;li&gt;Memory can be somewhat limited&lt;/li&gt;
    &lt;li&gt;CPU time is plentiful&lt;/li&gt;
    &lt;li&gt;ZFS ARC auto compresses what can be compressed&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Deduplication (Dedup)&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;ZFS deduplication isn&amp;#x27;t good as you would imagine it is&lt;/li&gt;
    &lt;li&gt;Only duplicates identical filesystem blocks&lt;/li&gt;
    &lt;li&gt;Most data is not ZFS deduplicable&lt;/li&gt;
    &lt;li&gt;1TB of dedup&amp;#x27;d data = 5G RAM for the dedup process&lt;/li&gt;
    &lt;li&gt;Dedup RAM X 4 = System RAM&lt;/li&gt;
    &lt;li&gt;Effectiveness: run zdb -S zroot, check dedup column&lt;/li&gt;
    &lt;li&gt;Cost-effective ZFS dedup just doesn&amp;#x27;t exist&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Snapshots&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;# zfs snapshot trinity/home@&amp;lt;today&amp;#x27;s date&amp;gt;&lt;/li&gt;
    &lt;li&gt;# zfs list -t snapshot&lt;/li&gt;
    &lt;li&gt;# zfs -r zroot@&amp;lt;today&amp;#x27;s date&amp;gt;&lt;/li&gt;
    &lt;li&gt;Access snapshots in hidden .zfs directory (especially when using ZFSonLinux)&lt;/li&gt;
    &lt;li&gt;# zfs destroy trinity/home@&amp;lt;today&amp;#x27;s date&amp;gt;&lt;/li&gt;
    &lt;li&gt;Use -vn in destroy operations&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Snapshot Disk Use&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Delete file from live filesystem&lt;/li&gt;
    &lt;li&gt;Blocks in a snapshot remain in use&lt;/li&gt;
    &lt;li&gt;Blocks are freed only when no snapshot uses them&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Roll Back&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Can rollback filesystem to the most recent snapshot&lt;/li&gt;
    &lt;li&gt;# zfs rollback zroot/ROOT/@&amp;lt;before upgrade&amp;gt;&lt;/li&gt;
    &lt;li&gt;Newer data is destroyed&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Clones&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;A read-write copy of a snapshot&lt;/li&gt;
    &lt;li&gt;# zfs clone zroot/var/mysql@&amp;lt;today&amp;gt; \ zroot/var/mysql-test&lt;/li&gt;
    &lt;li&gt;Run a test, then discard afterward&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;Boot Environments&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Built on clones and snapshots&lt;/li&gt;
    &lt;li&gt;Snapshot root filesystem dataset before an upgrade&lt;/li&gt;
    &lt;li&gt;If Upgrade goes awry. Roll back!&lt;/li&gt;
    &lt;li&gt;FreeBSD: sysutils/beadm&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h3&gt;ZFS Send/Receive&lt;/h3&gt;
  &lt;ul&gt;
    &lt;li&gt;Move whole filesystems to another host&lt;/li&gt;
    &lt;li&gt;Blows rsync out of the water&lt;/li&gt;
    &lt;li&gt;Resumable&lt;/li&gt;
  &lt;/ul&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/Sk68PBb1U?cda=&quot; target=&quot;_blank&quot;&gt;Let&amp;#x27;s install ZFS in Linux and start using it&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:HkV-xNH18</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/HkV-xNH18?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Designating Hot Spares in Your ZFS Storage Pool</title><published>2019-12-28T21:24:52.001Z</published><updated>2019-12-28T23:19:45.794Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/ab/b9/abb9c8d6-1227-4346-bb15-48a4c097651b.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/ed/1b/ed1bcab0-dc11-4c42-8920-a8f05e14ee7d.png&quot;&gt;There is a feature built into ZFS called the &quot;hotspares&quot; feature which allows a sysadmin to identify those drives available as spares which can be swapped out in the event of a drive failure in a storage pool. If an appropriate flag is set in the feature, the &quot;hot spare&quot; drive can even be swapped automatically to replace the failed drive. Or, alternatively, a spare drive can be swapped manually if the sysadmin detects a failing drive that is reported as irreparable.  </summary><content type="html">
  &lt;p&gt;There is a feature built into ZFS called the &amp;quot;hotspares&amp;quot; feature which allows a sysadmin to identify those drives available as spares which can be swapped out in the event of a drive failure in a storage pool. If an appropriate flag is set in the feature, the &amp;quot;hot spare&amp;quot; drive can even be swapped automatically to replace the failed drive. Or, alternatively, a spare drive can be swapped manually if the sysadmin detects a failing drive that is reported as irreparable.  &lt;/p&gt;
  &lt;p&gt;Hot spares can be designated in the ZFS storage pool in two separate ways:&lt;/p&gt;
  &lt;blockquote&gt;When the pool is created using the &lt;strong&gt;zpool create&lt;/strong&gt; command, and&lt;/blockquote&gt;
  &lt;blockquote&gt;After the pool is created using the &lt;strong&gt;zpool add &lt;/strong&gt;command&lt;/blockquote&gt;
  &lt;p&gt;Before beginning to create the ZFS storage pool and identifying the spares, I want to list the available drives in my Debian 10 Linux VM in VirtualBox 6.0. I can accomplish this in the Terminal using the command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/ed/1b/ed1bcab0-dc11-4c42-8920-a8f05e14ee7d.png&quot; width=&quot;827&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Here, we see that I have 7 total drives apart from the primary drive, /dev/sda, used by Debian 10 Linux. These drives are listed above and range from /dev/sdb ... to /dev/sdh.&lt;/p&gt;
  &lt;p&gt;Therefore, I plan to create a ZFS storage pool called &lt;strong&gt;trinity&lt;/strong&gt; with a mirror of two drives: &lt;strong&gt;sdb&lt;/strong&gt; and &lt;strong&gt;sdc&lt;/strong&gt;; and hot spares which I will identify as &lt;strong&gt;sdd&lt;/strong&gt; and &lt;strong&gt;sde&lt;/strong&gt;. &lt;/p&gt;
  &lt;p&gt;The diagram below illustrates the new ZFS mirrored storage pool with the two spares identified. In addition, I have taken the liberty of recreating the trinity/data, .../apps, and .../datapioneer datasets:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/ab/b9/abb9c8d6-1227-4346-bb15-48a4c097651b.png&quot; width=&quot;1044&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt; As reported above using the &lt;strong&gt;zpool status&lt;/strong&gt; or &lt;strong&gt;zpool status trinity&lt;/strong&gt; command, the two mirror drives sdb &amp;amp; sdc are ONLINE and I have identified two AVAIL spares sdd &amp;amp; sde. If I want to remove one of the hotspares and replace it with another drive, I can do this using the &lt;strong&gt;zpool remove&lt;/strong&gt; command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/1a/92/1a924edb-dc78-4297-bd2f-6b048519f43d.png&quot; width=&quot;699&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Since the spare drive was not INUSE but was AVAIL instead, we were able to remove it. Had it been INUSE, this wouldn&amp;#x27;t be allowed. Instead, the drive would have to be manually taken OFFLINE first, then removed.  &lt;em&gt;One important thing to keep in mind here is that drives identified as spares in the system must have a drive capacity &amp;gt;= largest drive in the storage pool. &lt;/em&gt;Let&amp;#x27;s add another spare to the storage pool by replacing the drive sdd that we previously removed. This is accomplished by running the &lt;strong&gt;zpool add trinity spare&lt;/strong&gt; command and inserting the &lt;em&gt;sdd&lt;/em&gt; drive designated as the replacement:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/cf/95/cf95afb2-bf8e-4682-a1e9-a01cfa704051.png&quot; width=&quot;718&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;As an aside, if at anytime you wish to determine the health of a ZFS storage pool, you can either run the zpool trinity status command or zpool trinity status -x command. The latter will actually list the health so you don&amp;#x27;t have to look at the STATE category of the status screen: &lt;/p&gt;
  &lt;p&gt;root@debian-10-desktop-vm:/trinity# &lt;strong&gt;zpool status trinity -x&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;pool &amp;#x27;trinity&amp;#x27; is healthy&lt;/em&gt;&lt;/p&gt;
  &lt;p&gt;Now, if an ONLINE drive fails, the zpool will move into a DEGRADED state.  The failed drive can then be replaced manually by the sysadmin or, if the sysadmin has set the &lt;strong&gt;autoreplace=on&lt;/strong&gt; in the property of the zpool, the failed drive will be automatically replaced by ZFS. The command to set this property in this example is:&lt;/p&gt;
  &lt;p&gt;root@debian-10-desktop-vm:/trinity# &lt;strong&gt;zpool set autoreplace=on trinity&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;We can simulate the failure of one of our drives by manually taking it OFFLINE. So, let&amp;#x27;s pretend that drive sdb fails by manually OFFLINE&amp;#x27;ing it:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/03/80/0380deee-e63f-4983-ad57-a1b51c6b033a.png&quot; width=&quot;845&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Note here that sdb now shows DEGRADED in the status and the overall status of the Zpool Trinity is in a DEGRADED State as well. If this had been a real world scenario where a drive failure actually occurred instead of simulating the failure by OFFLINE&amp;#x27;ing the drive, one of the AVAIL spares would have replaced the failed drive, sdb, with either sde or sdd, reducing the AVAIL spares by one and bringing the Zpool back to ONLINE status. I can either ONLINE the device, sdb, since I know it to be a good drive, or I can simulate replacing this drive with one of the spares but doing so through a manual rather than automatic process.  I will demonstrate the latter process using the &lt;strong&gt;zpool replace&lt;/strong&gt; command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/83/80/83804da7-9537-43f6-8d49-92da34368329.png&quot; width=&quot;944&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now, the current status after running the zpool replace trinity sdb sde command to replace the failed sdb drive with the hotspare sde indicates that spare sde is currently INUSE rather than AVAIL and sde is ONLINE. &lt;/p&gt;
  &lt;p&gt;And, finally, if we detach the failed (OFFLINE) drive using the &lt;strong&gt;zpool detach trinity sdb&lt;/strong&gt; command, the status of the Zpool storage pool should be returned to ONLINE in healthy status:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/a4/cf/a4cf9966-ebba-4278-881b-312c03535cb8.png&quot; width=&quot;946&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Note, now the AVAIL spares has been reduced to sdd only and sde has replaced the failed sdb drive which was formerly OFFLINE. The drive was resilvered with 507K bytes with 0 errors returned and this process was accomplished on Sat Dec 28 2019 at 16:04:34 Local time. &lt;/p&gt;
  &lt;p&gt;The last thing that we can do here before wrapping up this article is to add another drive to the &amp;quot;hot spares&amp;quot; list. We know from the previous command that we ran that we have drive sdf available for this purpose. So, let&amp;#x27;s add this drive as a spare. Since the drive, sdf, is being added after the ZFS storage pool was created, we can use the &lt;strong&gt;zpool add trinity spare sdf&lt;/strong&gt; command to add this drive as an AVAIL spare:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/ac/e6/ace6e5d0-fedb-405d-bb8f-77d82e53fde0.png&quot; width=&quot;942&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now, we have two spares AVAIL instead of the single drive and our ZFS storage pool is healthy once again.&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/Sk68PBb1U?cda=&quot; target=&quot;_blank&quot;&gt;Return to beginning of the article - Part 1&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:HkX83eHkL</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/HkX83eHkL?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Setting Up Quotas &amp; Reservations in OpenZFS in Linux</title><published>2019-12-28T17:02:41.964Z</published><updated>2019-12-28T23:17:58.793Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/60/6e/606ea314-7309-45d1-a54f-e671c882d28b.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/60/6e/606ea314-7309-45d1-a54f-e671c882d28b.png&quot;&gt;ZFS supports quotas and reservations at the filesystem level. Quotas in ZFS set limits on the amount of space that a ZFS filesystem can use. Reservations in ZFS are used to guarantee a certain amount of space is available to the filesystem for use for apps and other objects in ZFS. Both quotas and reservations apply to the dataset the limits are set on and any descendants of that dataset.</summary><content type="html">
  &lt;p&gt;ZFS supports quotas and reservations at the filesystem level. Quotas in ZFS set limits on the amount of space that a ZFS filesystem can use. Reservations in ZFS are used to guarantee a certain amount of space is available to the filesystem for use for apps and other objects in ZFS. Both quotas and reservations apply to the dataset the limits are set on and any descendants of that dataset.&lt;/p&gt;
  &lt;p&gt;Primarily, quotas are set to limit the amount of space that a particular user of the system can consume so that no one user maximizes the Zpool in the dataset. In this article, I have setup two users in the Linux system: &lt;strong&gt;datapioneer&lt;/strong&gt; (myself as the primary user) and &lt;strong&gt;dante&lt;/strong&gt; (a secondary user of the Linux system) upon which OpenZFS on Linux has been installed.&lt;/p&gt;
  &lt;p&gt;Let&amp;#x27;s look at the zpool that I currently have setup in Linux for this example. Running both &lt;strong&gt;zpool status&lt;/strong&gt; and &lt;strong&gt;zfs list&lt;/strong&gt; commands in Debian 10 Linux produce the following profile of the ZFS filesystem:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/60/6e/606ea314-7309-45d1-a54f-e671c882d28b.png&quot; width=&quot;849&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt; Here, I have a RAIDZ of 3 SCSI drives with a logs mirror and two-drive SSD Zil SLOG. All drives are ONLINE and the zfspool is also ONLINE and healthy. As shown, the zfspool/data dataset is using 12M of data out of a total space of 19.0G. This means that both datapioneer and dante have access to this total 19.0G of zfspool drive space across the drives. I would like to limit the user, dante, to 5G of drive space so he doesn&amp;#x27;t inadvertently fill up the Zpool with data. In addition, I would like to reserve 5G of the Zpool under the dataset zfspool/apps for applications. Here&amp;#x27;s how we can accomplish both.&lt;/p&gt;
  &lt;p&gt;To limit 5G of drive space as a quota for dante under zfspool/data, we can run the following command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/d9/d6/d9d65fea-a87d-40fb-8a78-ef84e8c1d82c.png&quot; width=&quot;900&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Setting the quota for dante under the zfspool/data/dante dataset to 5G is performed using: &lt;strong&gt;zfs set quota=5G zfspool/data/dante&lt;/strong&gt;. In the figure above, I ran a &lt;strong&gt;zfs list&lt;/strong&gt; to look at the current listing of drive utilization and you can see that dante has the entire 19.0G available to him. After running the &lt;em&gt;zfs set quota&lt;/em&gt; command, we can confirm that we have limited dante to 5G by running the &lt;strong&gt;zfs get quota zfspool/data/dante&lt;/strong&gt; command showing a value of 5G for the property: &lt;em&gt;Quota&lt;/em&gt;. Rerunning zfs list also shows that only 4.99G, ~ 5G, is currently available to dante. However, note that the user datapioneer still has full use of the zpool wherein the amount of 19.0G of space is showing as available.  The user dante will only be able to fill up 5G of space under the zfspool/data/dante dataset and any attempts to add more data to the drives will be denied. Now, if we add a child dataset called &lt;strong&gt;ws&lt;/strong&gt; under zfspool/data/dante, the quota for &lt;strong&gt;/zfspool/data/dante/ws&lt;/strong&gt; inherits the 5G limitation:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/29/0b/290b5aa7-64c3-444e-913a-b2e50ad3a3bd.png&quot; width=&quot;856&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now, let&amp;#x27;s set a 5G reservation for apps under /zfspool/apps. What this means is that the ZFS filesystem will set aside 5G of drive space for use by apps only and nothing else will be able to use it. This is different from quotas set up in the system since setting quotas allow drive space use up to a certain value whereas establishing a reservation tells the ZFS filesystem not to allow use of the reserved amount by any object in the system other than apps under &lt;em&gt;/zfspool/apps&lt;/em&gt;. To set a reservation of 5G for apps dataset in ZFS, we can run the command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/a0/56/a0566f3d-13d5-4264-bca3-24a65c82fcac.png&quot; width=&quot;906&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;After setting the 5G reservation in ZFS for apps, we see that the amount USED for &lt;em&gt;zfspool&lt;/em&gt; in the system has increased from 24.4M to 5.02G (which includes the 5G reservation for apps) with 14.0G AVAIL instead of 19.0G AVAIL prior to setting up the reservation. Also, note that the amount available for apps under &lt;em&gt;/zfspool/apps&lt;/em&gt; remains at 19.0G which does not establish a quota of any kind since this amount AVAIL remains unchanged before and after the reservation was set. However, what should be realized here is that the amount of space AVAIL to dante remains at 5G (as established in the Quota we setup earlier) but, the total amount AVAIL for datapioneer has been reduced from 19.0G to 14.0G (the difference being 5G) which reflects the fact that 5G of space has been reserved for apps and is no longer available to any other object in the &lt;em&gt;zfspool&lt;/em&gt; system. &lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/HkV-xNH18?cda=&quot; target=&quot;_blank&quot;&gt;Designating &amp;quot;Hot Spares&amp;quot; in the Storage Pool in OpenZFS - Part 6&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:rJOfqWQy8</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/rJOfqWQy8?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Logs Mirror, Cache, &amp; Snapshots in OpenZFS Filesystem on Linux</title><published>2019-12-27T23:15:25.279Z</published><updated>2019-12-31T03:01:15.235Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/b8/eb/b8eb1f57-027e-4d8e-b1cb-1df617b4d363.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/b8/eb/b8eb1f57-027e-4d8e-b1cb-1df617b4d363.png&quot;&gt;Another big advantage to installing ZoL or OpenZFS filesystem on Linux is that as the sysadmin you can create a mirror of two SCSI drives in the filesystem containing your system logs and create a cache consisting of two SSD drives in the filesystem containing system cache information. The logs mirror helps to balance the load of the ZFS pool in the system and also helps to ensure that your log files are preserved in the event of RAIDZ failure. The cache is a part of the ARC (Adaptive Replacement Cache) system in OpenZFS and assists in rebuilding drives to restore your system if drives begin to fail. Read cache is referred to as L2ARC (Level 2 Adaptive Replacement Cache), synchronous write cache is ZIL (ZFS Intent Log), SLOG (Separate...</summary><content type="html">
  &lt;p&gt;Another big advantage to installing ZoL or OpenZFS filesystem on Linux is that as the sysadmin you can create a mirror of two SCSI drives in the filesystem containing your system logs and create a cache consisting of two SSD drives in the filesystem containing system cache information. The logs mirror helps to balance the load of the ZFS pool in the system and also helps to ensure that your log files are preserved in the event of RAIDZ failure. The cache is a part of the ARC (Adaptive Replacement Cache) system in OpenZFS and assists in rebuilding drives to restore your system if drives begin to fail. Read cache is referred to as L2ARC (Level 2 Adaptive Replacement Cache), synchronous write cache is ZIL (ZFS Intent Log), SLOG (Separate Log Device).&lt;/p&gt;
  &lt;p&gt;To prepare for the creation of the logs mirror, I added two additional 10G SCSI drives to the ZFS pool. These are designated as /dev/sde and /dev/sdf, respectively. Next, I ran the following command in the Terminal to add the logs mirror:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/b8/eb/b8eb1f57-027e-4d8e-b1cb-1df617b4d363.png&quot; width=&quot;1035&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Creating the logs mirror pretty much guarantees preservation of logs information in OpenZFS in the event of drive failure. Creating the logs mirror is just the first step in creating what is referred to as the ZIL, SLOG which is a fast persistent write cache for ZFS writes to disk. Note I said creating the logs mirror is the first step. Now that we have created the logs mirror in ZFS, the second step is to create what is known as the ZFS cache (a part of the L2ARC - Level 2 Adaptive Replacement Cache). To create the cache in the system, I added two high speed SSD drives /dev/sdg and /dev/sdh and then ran the following command:&lt;/p&gt;
  &lt;p&gt;# &lt;strong&gt;zpool add zspool cache /dev/sdg /dev/sdh&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;To check the status of the zpool at this point, we can rerun the &lt;strong&gt;zpool status&lt;/strong&gt; command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/ae/81/ae81ecd9-d52b-455a-ba79-77a92e27c1bb.png&quot; width=&quot;559&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The size of the disks that contain the logs and cache need to be determined based on the performance of your system. Monitoring this will give you a better indication of the apparent size these drives need to be. Using high speed SSDs or NVMe M.2 drives for the cache rather than traditional SCSI drives is a good idea especially if you don&amp;#x27;t want to start running into performance bottlenecks when cache information is being written to these cache drives during OpenZFS resilvering of replacement drives.&lt;/p&gt;
  &lt;p&gt;Combining the ZIL and Separate Log Device (SLOG) in the ZIL, SLOG configuration that you see above, you are essentially balancing the load on your system using OpenZFS.&lt;/p&gt;
  &lt;p&gt;ZFS Snapshots are essentially instances in time of the ZFS filesystem across the entire pool or datasets within the pool that you wish to capture. Snapshots in ZFS are read-only, immutable, great for backups since you can backup the snapshot rather than the files, and snapshots within the same host are not backups. Snapshots can be exported from one host to another host or within the same host. When creating snapshots, it is important to note that these snapshots in Linux will be represented in the system as hidden directories under the dataset wherein they are created with the snapshots being placed in those hidden directories. Files within the snapshots that are deleted may be restored using a rollback procedure which I will demonstrate below. Let&amp;#x27;s create a snapshot of the /zfspool/data/apps dataset:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/a7/97/a7975e3f-7ce0-4b9b-8f61-a4ad2f68c938.png&quot; width=&quot;1021&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The command: # &lt;strong&gt;zfs snapshot zfspool/apps@271220191653&lt;/strong&gt; which creates a snapshot of the apps dataset represents an instance in time at 16:53 on 27 December 2019 of the zfspool/apps dataset. &lt;/p&gt;
  &lt;p&gt;After creating this snapshot, I used vim to create a file called &lt;strong&gt;file1&lt;/strong&gt; which I placed in the &lt;strong&gt;/zfspool/apps&lt;/strong&gt; directory where the snapshot was created:&lt;/p&gt;
  &lt;p&gt;root@debian-10-desktop-vm:/zfspool/apps# ls -lh&lt;br /&gt;total 1.0K&lt;br /&gt;-rw-r--r-- 1 root root 15 Dec 27 16:55 &lt;strong&gt;file1&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;Now, if I rollback the snapshot using the ZFS rollback command, this file should no longer exist since it was created after the snapshot &lt;strong&gt;zfspool/apps@271220191653 &lt;/strong&gt;was created:&lt;/p&gt;
  &lt;p&gt;root@debian-10-desktop-vm:/zfspool/apps# &lt;strong&gt;zfs rollback zfspool/apps@271220191653&lt;/strong&gt;&lt;br /&gt;root@debian-10-desktop-vm:/zfspool/apps# ls -lh&lt;br /&gt;&lt;strong&gt;total 0&lt;/strong&gt;&lt;br /&gt;root@debian-10-desktop-vm:/zfspool/apps# &lt;br /&gt;&lt;/p&gt;
  &lt;p&gt;and, indeed, the rollback has eliminated the file which was created earlier. Snapshots allow you to create a mark in time for your system. If you wish to list out the snapshots that have been created in the ZFS filesystem, you can accomplish this using the command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/39/42/39428054-ea07-43bb-9ec0-1d6499d5dd2c.png&quot; width=&quot;704&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;These snapshots do take up space on your system, but, as you can see here, this snapshot is only using 17.3K in the system.&lt;/p&gt;
  &lt;p&gt;And, finally, if you want to move a zpool to another machine, you need to get out of the zpool you wish to move, then use the following command:&lt;/p&gt;
  &lt;p&gt;root@debian-10-desktop-vm:/zfspool/apps# pwd&lt;br /&gt;/zfspool/apps&lt;br /&gt;root@debian-10-desktop-vm:/zfspool/apps# cd ../../&lt;br /&gt;root@debian-10-desktop-vm:/# pwd&lt;br /&gt;/&lt;br /&gt;root@debian-10-desktop-vm:/# &lt;strong&gt;zpool export zfspool&lt;/strong&gt;&lt;br /&gt;root@debian-10-desktop-vm:/# zpool status&lt;br /&gt;&lt;strong&gt;no pools available&lt;/strong&gt;&lt;br /&gt;root@debian-10-desktop-vm:/#&lt;/p&gt;
  &lt;p&gt;As you can see above, I moved up the directory tree two levels to the / directory, then ran the command which is highlighted. After running the &lt;strong&gt;zpool status&lt;/strong&gt; command, you see that no pools are available. This is because the zpool has been exported. I did not use the switch on the export command to direct the export to a specific directory in Linux, but you probably should do this so you know where you put it. In this example, I let it place the exported zpool in the default location because I am going to turn right around and import the zpool back to its original location. I do this using the ZFS import command like this:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/df/1b/df1b62c4-ba19-4dfc-a874-84576c1114c7.png&quot; width=&quot;564&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The zpool zfspool has been returned and running a status on the pool returns good status as before. &lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/HkX83eHkL?cda=&quot; target=&quot;_blank&quot;&gt;Setting up Quotas &amp;amp; Reservations in OpenZFS - Part 5&lt;/a&gt;&lt;/p&gt;
  &lt;p&gt;&lt;br /&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:Sk88mPzyU</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/Sk88mPzyU?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Investigating RAIDZ in Debian 10 &quot;Buster&quot; Linux</title><published>2019-12-26T20:17:26.342Z</published><updated>2019-12-29T03:56:05.786Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/43/ee/43eeebe9-6aca-4efd-8276-efcd4574e1a5.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/43/ee/43eeebe9-6aca-4efd-8276-efcd4574e1a5.png&quot;&gt;Now that we have looked at implementing OpenZFS on Linux in Debian 10 Linux and created zfs pool mirrors using OpenZFS as well as created and accessed ZFS datasets on the system, let's turn our attention to implementing RAID in OpenZFS. How does implementing RAID in OpenZFS compare to traditional RAID solutions? Is there a one-to-one correlation between RAIDZ and traditional RAID? Are there advantages to running RAIDZ rather than the traditional RAID solutions? </summary><content type="html">
  &lt;p&gt;Now that we have looked at &lt;a href=&quot;https://inlinuxveritas.com/Sk68PBb1U?cda=&quot; target=&quot;_blank&quot;&gt;implementing OpenZFS on Linux in Debian 10 Linux&lt;/a&gt; and created zfs pool mirrors using OpenZFS as well as created and accessed ZFS datasets on the system, let&amp;#x27;s turn our attention to implementing RAID in OpenZFS. How does implementing RAID in OpenZFS compare to traditional RAID solutions? Is there a one-to-one correlation between RAIDZ and traditional RAID? Are there advantages to running RAIDZ rather than the traditional RAID solutions? &lt;/p&gt;
  &lt;p&gt;RAIDZ in OpenZFS is roughly equivalent to RAID-5 in the traditional RAID world which requires at least 4 drives with one drive serving as a parity drive. RAIDZ (RAID-5) can survive the loss of one drive and still function in the RAID. RAIDZ2 is roughly equivalent to RAID-6 which requires a total of 6 drives with two drives serving as parity drives. RAIDZ2 (RAID-6) can survive the loss of two drives and still function within the RAID-array. RAIDZ3 has no equivalent in traditional RAID. &lt;/p&gt;
  &lt;p&gt;The first thing that we need to do is to destroy the current zpool arrangement that we established when I showed you how to implement OpenZFS on Debian 10 &amp;quot;Buster&amp;quot; Linux and set up ZFS pools or mirrors in the original article shown in paragraph 1 above. The process of destroying the ZFS pools is irreversible, so if there is any data that is important to you or you want to go back to this OpenZFS configuration, then you should perform a backup by taking a snapshot of the system. We are using VirtualBox 6.0 Manager to create this OpenZFS environment in Debian 10 Linux, so it is very simple to create a snapshot. If you don&amp;#x27;t know how to create a snapshot of your VM (similar to creating a Restore Point in Windows), then &lt;a href=&quot;https://www.techrepublic.com/article/how-to-use-snapshots-in-virtualbox/&quot; target=&quot;_blank&quot;&gt;consult this resource&lt;/a&gt; on how to accomplish this prior to moving forward.&lt;/p&gt;
  &lt;p&gt;Before destroying the current ZFS pool configuration, I suggest shutting down the VM and adding some additional SCSI drives. In the example below, I have added three more virtual SCSI drives to the VM. These are /dev/sdf, /dev/sdg, and /dev/sdh for a total of seven SCSI drives in the system. &lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/43/ee/43eeebe9-6aca-4efd-8276-efcd4574e1a5.png&quot; width=&quot;719&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now, restart the VM and return to the Terminal in Debian 10. To destroy the current OpenZFS configuration we established in Linux, obtain elevated privileges in the system by becoming root, then run the following command as shown in the diagram below:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/ac/2a/ac2a1af9-4820-4a43-a518-332b207098ab.png&quot; width=&quot;587&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The &lt;strong&gt;zpool destroy zfspool &lt;/strong&gt;command is akin to running &lt;em&gt;rm -Rf &amp;lt;directory name&amp;gt;&lt;/em&gt; in Linux as this command will recursively remove all ZFS pools and datasets that currently reside on the system. Rerunning the &lt;strong&gt;zpool list&lt;/strong&gt; command afterward confirms that we no longer have any OpenZFS pools or datasets present in the Linux system. It is worth mentioning here that this command not only removes all OpenZFS pools and datasets, but it also removes any snapshots that may have been taken in ZFS as well as any exports you may have performed and the zfs mountpoints that were created. Therefore, backups are critical at this point as reversing this process is impossible.&lt;/p&gt;
  &lt;p&gt;So, what is RAIDZ? Essentially, RAIDZ is the implementation of RAID in OpenZFS which is roughly equivalent to RAID-5 using traditional software/hardware RAID in Linux. One primary distinction between RAIDZ and RAID-5 that I would like to mention at this point is that unlike traditional RAID-5, RAIDZ does not read block-by-block when it rebuilds a drive that may be lost in the RAID or that is manually replaced in the RAID prior to failure. Rather, RAIDZ only looks at the data that resides on the SCSI drive(s) that are rebuilt and writes back to the replaced drive(s) only the data not a block-by-block restoration of the drive(s) itself. When OpenZFS restores a RAID drive, it reports that the drive has been &amp;quot;resilvered&amp;quot;. We&amp;#x27;ll see this when I show you how to implement RAIDZ going forward in this article.&lt;/p&gt;
  &lt;p&gt;To create a RAIDZ or RAIDZ1 in Linux, I need to run the following command as root, then I can check the status of the newly-created RAIDZ running the subsequent command we&amp;#x27;ve run previously. This process will take a few seconds longer to run since the RAIDZ takes a little more work. Here we are creating an equivalent to a traditional RAID-5 using this one OpenZFS command and attaching three SCSI drives in the process. This RAIDZ will allow us to survive the loss of one drive without losing the RAID:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/7f/69/7f698274-518a-4ed3-a018-a2b91a5d45a9.png&quot; width=&quot;938&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now, if I want to add an additional RAIDZ pool under zfspool I can rerun the previous command replacing the &amp;quot;create&amp;quot; option with &amp;quot;add&amp;quot; and changing /dev/sdb, /dev/sdc, and /dev/sdd with /dev/sde, /dev/sdf, and /dev/sdg, respectively. See the diagram below:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/d5/95/d59550f9-542a-43de-89f3-c62b6b01ed65.png&quot; width=&quot;890&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Running a status of the zpool configuration now shows  that we have created two RAIDZ mirrors: raidz1-0 and raidz1-1 in the system. The first RAIDZ comprises drives sdb through sdd and the second RAIDZ comprises drives sde through sdg. All of these RAID mirrors are ONLINE and no known errors have been detected in the drives. &lt;/p&gt;
  &lt;p&gt;If you recall from the &lt;a href=&quot;https://inlinuxveritas.com/Sk68PBb1U?cda=&quot; target=&quot;_blank&quot;&gt;previous article on implementing OpenZFS in Linux&lt;/a&gt;, we set all the SCSI drives to a 10G capacity. Let&amp;#x27;s investigate how much drive capacity we have usable among the six 10G-capacity SCSI drives that we have implemented in this scheme:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/12/21/12215764-ca15-4afa-bffd-e68e891eb638.png&quot; width=&quot;554&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;From the diagram above, we see that OpenZFS is reporting a total of 38.1G of usable drive space out of a total of 60G. This is roughly 2/3rds of the available drive capacity among the six SCSI drives. We are losing 1/3rd of the capacity or roughly two SCSI drives to parity. In this RAIDZ configuration, we can survive the loss of a single drive and survive a system-wide data loss. We need to recreate the datasets /zfspool/apps, /zfspool/data, and /zfspool/data/datapioneer that we had previously. This is accomplished in the Terminal like so:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/52/ac/52acae62-9e17-4460-96a6-ec485ff58087.png&quot; width=&quot;827&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;We also need to reacquire the datapioneer dataset we just created which will require us to change ownership of /zfspool/data/datapioneer to datapioneer and group ownership to datapioneer as well as changing the permissions to 755 on this dataset (mounted directory for the zfspool in Linux). See the diagram below:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/65/76/65767cb1-b2db-454d-9b3d-a4b64437c126.png&quot; width=&quot;887&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Running ls -ld against the dataset confirms this has been accomplished. I have written a Bash script which writes data to the zpool we created and made accessible, namely, /zfspool/data/datapioneer. The bash script looks like the following:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/2d/c9/2dc99a0a-cafa-4e40-8660-3f1d38f5a3cf.png&quot; width=&quot;737&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;I called this bash script, data.sh., added the executable bit to the file, then ran the script which added 3M X 4 (over 4 tests) of data to the zfspool dataset. To confirm this, we can run the df -kh command in the Terminal. This reveals:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/0b/8a/0b8aa8f6-9c22-4ccd-a272-80b876f2e43c.png&quot; width=&quot;845&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;which demonstrates successful writing of ~12M (13M shown) of data to the dataset. Similarly, we can look at this in the GUI by bringing up the File Manager and taking a Properties sheet on the combined files test through test4 that were created in running the bash script:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/93/a2/93a2a3fd-b1cf-489a-9360-3eb72356ac0c.png&quot; width=&quot;772&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;So, now, let&amp;#x27;s look at some real world examples of how RAIDZ works. If we return to take a look at the status of the current RAIDZ, we see the following output:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/8a/30/8a303663-6be8-4d22-9490-98a29eb92648.png&quot; width=&quot;745&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Let&amp;#x27;s assume that we, as sysadmin, see a bunch of CKSUMs starting to show up on drive &lt;strong&gt;/dev/sdc&lt;/strong&gt; indicating a potential failure in that drive. We can take one of our spare drives, &lt;strong&gt;/dev/sdh,&lt;/strong&gt; and replace /dev/sdc with this spare. To accomplish this on-the-fly using OpenZFS, we run the following command in the Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/52/20/5220c69a-cbc2-4bea-b038-30b9ee833eec.png&quot; width=&quot;1050&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;In the command that we ran in the Terminal, we referenced &lt;strong&gt;/dev/sdc&lt;/strong&gt; as the drive to be replaced and &lt;strong&gt;/dev/sdh&lt;/strong&gt; as the drive replacing it. Note, under zfspool / raidz1-0 drive &lt;strong&gt;sdc&lt;/strong&gt; has been replaced by the spare drive, &lt;strong&gt;sdh&lt;/strong&gt;, which is showing up as ONLINE, and the comment following &amp;quot;scan:&amp;quot; indicated the zfspool has been &amp;quot;resilvered&amp;quot; which as I mentioned earlier is the equivalent to a RAID rebuilding of the replaced drive. Note, also, that this process took only 1 second to rebuild since unlike traditional RAID-5, RAIDZ looks only at the 12M of data that it needs to rewrite to the spare drive rather than rebuilding the entire 10G drive block-by-block.&lt;/p&gt;
  &lt;p&gt;So, now let&amp;#x27;s look at another real world scenario in which a SCSI drive in the RAIDZ zfspool actually fails. I have replaced /dev/sdh with /dev/sdc once again and then simulated a drive failure in drive /dev/sdc using the following command in the Terminal and outputting the status following the running of the command:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/6c/e0/6ce0d61b-404e-498e-a9d9-8683a3a67494.png&quot; width=&quot;976&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Taking /dev/sdc OFFLINE results in a degraded zfspool which is shown in the &amp;quot;state&amp;quot; of the pool as well as an OFFLINE status for sdc under raidz1-0 with a STATE of &amp;quot;degraded&amp;quot;. The &amp;quot;status&amp;quot; reported shows one or more devices has been taken offline by the administrator (simulating the failure) and that &amp;quot;sufficient replicas exist for the pool to continue functioning in a degraded state.&amp;quot; The recommended &amp;quot;action&amp;quot; is to &amp;quot;Online the device using &amp;#x27;zpool online&amp;#x27; or replace the device with &amp;#x27;zpool replace&amp;#x27;.&amp;quot;&lt;/p&gt;
  &lt;p&gt;In this example, we&amp;#x27;re going to ONLINE the drive /dev/sdc, by running the appropriate command shown below, then rerunning a status to show the current state of the zpool in a non-DEGRADED state:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/62/50/6250c593-cf0d-4b5a-8ee6-ae7f943776f6.png&quot; width=&quot;974&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The drive, /dev/sdc, has been resilvered and the entire zfspool has been returned to an ONLINE status from DEGRADED status reported earlier.&lt;/p&gt;
  &lt;p&gt;Now, notice that when we run &lt;strong&gt;zfs list&lt;/strong&gt; again in the Terminal, I, as datapioneer, have access to 38.1G of usable drive space across the six SCSI drives and, could theoretically fill that entire space on my own. &lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/f3/e3/f3e36245-969a-4b5f-8d2c-a877badbbbc9.png&quot; width=&quot;845&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;But, in OpenZFS, there is a way to limit the amount of this usable space that a single user can consume. This is referred to as establishing a QUOTA on the pool. If I want to limit my quota of usable drive space to 100M rather than the entire 38.1G, I can run the following command in the Terminal:&lt;/p&gt;
  &lt;p&gt;# &lt;strong&gt;zfs set quota=100m zfspool/data/datapioneer&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;Then, we can confirm this by running the following command and looking at the output in the Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/75/cf/75cfeafd-9405-4c0e-8460-172c4dfec688.png&quot; width=&quot;1027&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The quota assigned to datapioneer is listed as 100M, not the full pool of 38.1G. So, if I start creating files that begin to fill up the pool beyond 100M, future actions to create files will be disallowed until action is taken to reduce the amount of used space across the six drives below the quota assigned to me. Granted, 100M of allowed space in today&amp;#x27;s world seems totally preposterous, but you get the point. &lt;/p&gt;
  &lt;p&gt;Another good example here would be to run a zfs command that would allow the administrator to reserve 100M of usable space for apps on the pool. Unlike quotas, this is considered a &lt;strong&gt;reservation&lt;/strong&gt; of space that is to be used by apps only so that no one else can use it. To perform this action in OpenZFS against the pool, we can run the following command in the Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/8d/a1/8da1930d-cb27-446d-b425-f7122e57345c.png&quot; width=&quot;1036&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;So, by looking at the before-and-after listing of zfs we see that initially there was 38.1G available space in zfspool. After running the reservation using the command shown to reserve 100M of space for apps, the amount of available space in zfspool has been effectively reduced to 38.0G so that others cannot use the difference of 0.1G or 100M. &lt;/p&gt;
  &lt;p&gt;And, finally, the last thing that I would like to show as an example of a real world scenario using OpenZFS is to simulate a process in OpenZFS that is similar to the process that can be performed in Linux but which is much more difficult to perform in the latter case. What I&amp;#x27;m referring to here is this. If you start noticing a drive might be failing or data might begin becoming corrupt on the drive, in Linux you would have to take the drive OFFLINE by &lt;strong&gt;umounting&lt;/strong&gt; the drive (and this could be in a Linux RAID scenario), then run &lt;strong&gt;fsck&lt;/strong&gt; against the drive, getting a status, then returning the drive ONLINE by &lt;strong&gt;mounting&lt;/strong&gt; it if you find there are no errors or if errors have been corrected. One of the beauties of OpenZFS is that a sysadmin can check a drive or the pool of drives in RAIDZ, for example, without having to OFFLINE a particular drive. This process is referred to as a &lt;strong&gt;SCRUB&lt;/strong&gt; in OpenZFS and it can be performed at anytime while the ZFS pool is functioning or on a schedule using Cron. To perform this action manually, you can run the following command in the Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/f2/30/f230e592-67d8-46e2-bc0f-0ca26054dd16.png&quot; width=&quot;996&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Running the command as shown above performed the scrub scan against the zfspool and it reports that 0B of data was repaired in 1 second. If lots of data were repaired instead, this would be an indication of corruption occurring in the pool and the sysadmin would be alerted to a potentially failing drive that needed action taken to replace.&lt;/p&gt;
  &lt;p&gt;In a future article, I will look at the implementation of RAIDZ2 and RAIDZ3 and its implications.&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/rJOfqWQy8?cda=&quot; target=&quot;_blank&quot;&gt;Logs, Mirrors, Cache, &amp;amp; Snapshots in OpenZFS in Linux - Part 4&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:Sk68PBb1U</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/Sk68PBb1U?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Installing and Using OpenZFS on Debian 10 &quot;Buster&quot; Linux</title><published>2019-12-26T05:05:36.047Z</published><updated>2019-12-29T03:26:03.912Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/a6/76/a6762812-6f3c-4bb5-aaac-4eb690c161a0.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/a6/76/a6762812-6f3c-4bb5-aaac-4eb690c161a0.png&quot;&gt;I am running Debian 10 &quot;Buster&quot; Linux in Virtual Box 6.0 Manager on my Win10 Pro Main PC using the debian10-1.0-amd64-netinst.iso file which I downloaded from the Debian Linux download page. This distro was originally installed as a VM using the ext4 filesystem for the primary partition represented as /dev/sda1 in the system. I wanted to experiment with using ZFS (ZetaByte File System) which was originally developed by Sun Microsystems and published under the CDDL license in 2005 as part of the OpenSolaris operating system. I further wanted to investigate this filesystem over others that are traditionally used in Linux, such as ext3/ext4/btrfs because ZFS is known for two specific reasons: (1) It stores large files in compressed format...</summary><content type="html">
  &lt;p&gt;I am running Debian 10 &amp;quot;Buster&amp;quot; Linux in Virtual Box 6.0 Manager on my Win10 Pro Main PC using the debian10-1.0-amd64-netinst.iso file which I downloaded from the &lt;a href=&quot;https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/&quot; target=&quot;_blank&quot;&gt;Debian Linux download page&lt;/a&gt;. This distro was originally installed as a VM using the ext4 filesystem for the primary partition represented as /dev/sda1 in the system. I wanted to experiment with using ZFS (ZetaByte File System) which was originally developed by Sun Microsystems and published under the CDDL license in 2005 as part of the OpenSolaris operating system. I further wanted to investigate this filesystem over others that are traditionally used in Linux, such as ext3/ext4/btrfs because ZFS is known for two specific reasons: (1) It stores large files in compressed format, and, (2) it decouples the filesystem from the hardware or the platform on which it is running. In my specific case, I&amp;#x27;m running Debian 10 in a Virtual Machine rather than on bare metal and I&amp;#x27;m running Linux, not Windows, MacOS, or BSD. &lt;/p&gt;
  &lt;p&gt;The implementation of ZFS that I am undertaking, however, isn&amp;#x27;t ZFS but, instead, is OpenZFS. I chose OpenZFS because unlike ZFS which is a proprietary filesystem developed under Oracle, the latter is opensource and community-supported and licensed under its own opensource licensing. OpenZFS has been ported from FreeBSD to Linux in support of the ZoL (ZFS on Linux) installation on Linux distros like Debian, Arch, Fedora, Gentoo, OpenSuse, RHEL and CentOS, and Ubuntu.&lt;/p&gt;
  &lt;p&gt;My OpenZFS on Debian 10 &amp;quot;Buster&amp;quot; Linux project was performed by following the steps below:&lt;/p&gt;
  &lt;p&gt;Step 1: Configure Debian 10 &amp;quot;Buster&amp;quot; Linux by setting it up in Oracle Virtual Box 6.0 Manager running in Windows 10 Pro and installing the operating system using the default ext4 filesystem. Apply all system updates prior to moving to Step 2, then shutdown the system.&lt;/p&gt;
  &lt;p&gt;Step 2: Add two VHD SCSI disks in the system designated as /dev/sdb and /dev/sdc, then restart the VM. See the diagram below which shows how I added the SCSI Controller in the Storage module, then added the two VHD SCSI Virtual Hard Drives on the SCSI Controller in the system:&lt;/p&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/a6/76/a6762812-6f3c-4bb5-aaac-4eb690c161a0.png&quot; width=&quot;718&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Step 3: For Debian Buster Linux, the ZFS packages are included in the contrib repository. In my case, I used the backports repository which typically contain updated releases of these ZFS packages. I added the backports repository in Debian 10 Buster using the following commands in the Linux Terminal:&lt;/p&gt;
  &lt;p&gt;# &lt;strong&gt;vi /etc/apt/sources.list.d/buster-backports.list&lt;/strong&gt;&lt;br /&gt;deb http://deb.debian.org/debian buster-backports main contrib&lt;br /&gt;deb-src http://deb.debian.org/debian buster-backports main contrib&lt;br /&gt;&lt;br /&gt;# &lt;strong&gt;vi /etc/apt/preferences.d/90_zfs&lt;/strong&gt;&lt;br /&gt;Package: libnvpair1linux libuutil1linux libzfs2linux libzpool2linux spl-dkms zfs-dkms zfs-test zfsutils-linux zfsutils-linux-dev zfs-zed&lt;br /&gt;Pin: release n=buster-backports&lt;br /&gt;Pin-Priority: 990&lt;/p&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Step 4: Run a system update to refresh the repositories using&lt;/p&gt;
  &lt;p&gt;# apt update&lt;/p&gt;
  &lt;p&gt;and then install the kernel headers and associated dependencies using&lt;/p&gt;
  &lt;p&gt;# apt install --yes dpkg-dev linux-headers-$(uname -r) linux-image-amd64&lt;br /&gt;&lt;/p&gt;
  &lt;p&gt;And, finally, install the ZFS packages by running&lt;/p&gt;
  &lt;p&gt;# apt-get install zfs-dkms zfsutils-linux&lt;/p&gt;
  &lt;p&gt;Step 5: My Debian 10 Buster Linux system was unable to find the &lt;strong&gt;zpool&lt;/strong&gt; command when I started to execute the commands in the Linux Terminal to setup the two SCSI drives as a ZFS mirror pool. So, I had to add the path to the zfs commands so BASH would recognize them. I ran the command:&lt;/p&gt;
  &lt;p&gt;# whereis zpool&lt;/p&gt;
  &lt;p&gt;which returned the location to the command as&lt;/p&gt;
  &lt;p&gt;/usr/sbin/zpool&lt;/p&gt;
  &lt;p&gt;Therefore, to allow my Linux system to find this command as well as other zfs commands by default, I modified the ~/.bashrc file and added the following line at the bottom of that file before saving it, then restarting the Terminal:&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;# adding the path to the zpool command in Linux&lt;br /&gt;export PATH=$PATH:/usr/sbin/&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;This makes the $PATH change persistent in the system. To prove this, I ran the command:&lt;/p&gt;
  &lt;p&gt;echo $PATH &lt;/p&gt;
  &lt;p&gt;in the Terminal and the following was returned:&lt;/p&gt;
  &lt;p&gt;/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:&lt;strong&gt;/usr/sbin/&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;indicating that the $PATH has been extended to include the location for the zfs commands in the system making these commands recognizable by BASH by default.&lt;/p&gt;
  &lt;p&gt;Next, I created a ZFS Pool using the two SCSI drives /dev/sdb and /dev/sdc I created earlier into a ZFS mirror-0, using the command:&lt;/p&gt;
  &lt;p&gt;# zpool create zfspool mirror /dev/sdb /dev/sdc&lt;/p&gt;
  &lt;p&gt;and checked the status of the ZFS pool I just created using the following &lt;strong&gt;zpool status&lt;/strong&gt; command with &lt;strong&gt;-v&lt;/strong&gt; switch, and then running the zfs list command to indicate the amount of pool space currently available and where it is mounted. I followed this up by running the &lt;strong&gt;df -kh&lt;/strong&gt; command to have Linux show me the filesystem breakdown in the system by human-readable blocksize. See these commands listed out below:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/e4/89/e489c8b6-fef9-4344-a998-46e4e9b334f2.png&quot; width=&quot;742&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Note above that the zfspool is showing up as ONLINE state and both sdb and sdc along with the associated mirror-0 are ONLINE as well. No errors were detected in these drives. The &lt;strong&gt;zfs list &lt;/strong&gt;command shows that 88.5k of data was written to the mirror for administrative tracking purposes leaving 9.3G out of 20G of total drive space (10GB X 2) as available for the zfspool mirrored drive. &lt;em&gt;Also, note that the mount of the zfspool at /zfspool as shown in the diagram above is persistent. It means that by implementing the OpenZFS filesystem using ZoL I am no longer required to update the /etc/fstab file in Linux each time I create a ZFS pool. Thus, the zfspool which was created is not managed by Linux at all. Instead, ZFS manages the pool of two drives, in this example, and automatically mounts the pool as mirror-0 (listing out the drives separately). &lt;/em&gt;&lt;/p&gt;
  &lt;p&gt;Step 6: Now, I want to expand my current zfspool of drives from its current 10G size to 20G by adding a new mirror of two drives designated as /dev/sdd and /dev/sde. To accomplish this, I need to stop the VirtualBox 6.0 Manager VM of Debian 10 Buster, then add two SCSI drives as VHD virtual drives which show up as /dev/sdd and /dev/sde in the Linux system. The process to add these two additional drives in VirtualBox 6.0 Manager is shown below:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/0f/5d/0f5dae0b-25f7-44c7-a974-db0f0cc9d1e7.png&quot; width=&quot;713&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Note, we now have two additional drives under the SCSI Controller: /dev/sdd and /dev/sde. Each of these drives were set to a size of 10G.&lt;/p&gt;
  &lt;p&gt;Next, I use the command:&lt;/p&gt;
  &lt;p&gt;# zpool add zfspool mirror /dev/sdd /dev/sde&lt;/p&gt;
  &lt;p&gt;which adds the two SCSI drives to the existing zfspool as mirrored drives. If I then list out the zpool, run the Linux command that displays the existing mount of zfspool and its size, and obtain a current status of the zpool, you can see that I have effectively expanded the existing zfspool I originally created to a size of 20G (doubling the drive space). &lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/04/74/0474a8c4-9358-49c3-9f4b-4c3cd42d96a8.png&quot; width=&quot;671&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Now that I&amp;#x27;ve created mirror-0 by combining /dev/sdb and /dev/sdc as well as mirror-1 by combining /dev/sdd and /dev/sde, I can no longer add more drives to either mirror. However, I can add additional drives by creating additional mirrors.&lt;/p&gt;
  &lt;p&gt;In ZFS, Pools are the equivalent of Disk Volumes in RAID and other disk-combining systems. Moreover, in ZFS, Datasets are the equivalent of data shares in those other systems. Thus, in the next step, I create my first dataset in ZFS underneath the zfspool mounted at /zfspool. &lt;/p&gt;
  &lt;p&gt;Step 7: To create a ZFS dataset called data under zfspool, I run the following command, then list out the status of the pool:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/a7/98/a7984236-40f4-4622-a72a-80d8faac66ee.png&quot; width=&quot;771&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;This creates zfspool/data mounted at /zfspool/data automatically and 24k of administrative data was written to the pool to keep track of it. Now, if I wanted to add another ZFS Dataset called apps and add another ZFS Dataset called datapioneer underneath the data ZFS Dataset, I can do this in the Terminal as follows:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/fa/7f/fa7fbe99-4682-4737-9f9d-235b03b21cfa.png&quot; width=&quot;901&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Step 8: To gain access to the /zfspool/data/datapioneer dataset and permissions to write to it, I can perform the following commands in the Linux Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/b5/4e/b54e158b-58e4-4f86-97a4-ad6d11c68141.png&quot; width=&quot;1028&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Listing the storage looking at directories only, you can see that I now own the /zfspool/data/datapioneer directory and the group owner of this directory is also datapioneer with rwx, r-x, and r-x permissions. This is possible in the Linux Terminal since ZFS has a Posix layer in its ZoL implementation in Linux. &lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/SyLKc3ZkL?cda=&quot; target=&quot;_blank&quot;&gt;Accessing The Mirror - Part 2&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:SyLKc3ZkL</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/SyLKc3ZkL?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Accessing an OpenZFS Mirror Created in Debian 10 Linux</title><published>2019-12-26T05:03:29.944Z</published><updated>2019-12-28T22:54:38.269Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/36/72/3672ba4d-2fb3-4cb5-a9f4-36b9778271d6.png"></media:thumbnail><category term="blog" label="Blog"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/36/72/3672ba4d-2fb3-4cb5-a9f4-36b9778271d6.png&quot;&gt;Now that we have created the ZFS Mirrors in the Linux system which point to four other SCSI drives of 10G capacity each, our two existing mirrors of two drives each are theoretically capable of accessing data of at least 20G in size. However, due to the overhead for keeping track of this data in the filesystem, our Linux system show a total data access space of around 19G. </summary><content type="html">
  &lt;p&gt;Now that we have created the ZFS Mirrors in the Linux system which point to four other SCSI drives of 10G capacity each, our two existing mirrors of two drives each are theoretically capable of accessing data of at least 20G in size. However, due to the overhead for keeping track of this data in the filesystem, our Linux system show a total data access space of around 19G. &lt;/p&gt;
  &lt;p&gt;If I open the Linux Terminal and run a listing of the storage using the ls command, then change directory to the zfspool to the subdirectory called datapioneer under the data subdirectory of zfspool, and then run the df -kh command, the output indicates the 19G blocksize that I mentioned above. &lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/36/72/3672ba4d-2fb3-4cb5-a9f4-36b9778271d6.png&quot; width=&quot;1278&quot; /&gt;
  &lt;/figure&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/38/0b/380b09e9-e579-4307-93f6-1f9759f108af.png&quot; width=&quot;855&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;The total available space in the /zfspool/data/datapioneer dataset directory is 19G. This can be seen both in the Terminal and in File Manager as shown above. Now, since I changed ownership of this directory to datapioneer and set the permissions on the directory to 755, as datapioneer in the Linux system I should be able to touch this directory and create a file, name the file, add some content to it, and save the file under /zfspool/data/datapioneer with a total of 19G of available space in which to do so. This is demonstrated below in the Terminal:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/bb/fb/bbfb78b9-423b-40b0-a3b3-daaf4fab8d2a.png&quot; width=&quot;1321&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Here, a new file was created called newFile.txt containing the text shown in double quotes following the echo command which is then redirected as output to the file itself. Opening this file in File manager shows a clearer picture in the GUI:&lt;/p&gt;
  &lt;figure class=&quot;m_original&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/77/6b/776b4201-6628-4cf7-ae5a-adc02dd71bf2.png&quot; width=&quot;889&quot; /&gt;
  &lt;/figure&gt;
  &lt;p&gt;Thus, we have created an additional 20G available ZFS pool of 4 SCSI drives of 10G capacity each that allow us to expand our available space across all four drives in the Linux system for storing our files which can be also be shared on the network.&lt;/p&gt;
  &lt;p&gt;If, in the future, additional storage space is needed, then all that is required is to install the additional SCSI drives, create a new mirror, and add them to the ZFS Pool expanding the total space across all drives in the Linux system. This is easily performed under OpenZFS. In this example I used small capacity SCSI drives, but I could just as easily add 1, 2, 3, or 4TB SCSI drives in a mirrored fashion to greatly enhance available storage and doing so is accomplished quite easily, as you can see, with the implementation of ZoL in Linux.&lt;/p&gt;
  &lt;p&gt;&lt;a href=&quot;https://inlinuxveritas.com/Sk88mPzyU?cda=&quot; target=&quot;_blank&quot;&gt;Investigating RAIDZ in Debian 10 &amp;quot;Buster&amp;quot; Linux - Part 3&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:HkgGuWDsr</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/HkgGuWDsr?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Personal Writing Blog</title><published>2019-11-11T16:10:47.796Z</published><updated>2019-11-11T16:12:16.807Z</updated><category term="links" label="Links"></category><summary type="html">@ Scripto (Veritas)</summary><content type="html">
  &lt;p&gt;&lt;a href=&quot;https://teletype.in/@scripto&quot; target=&quot;_blank&quot;&gt;@ Scripto (Veritas)&lt;/a&gt;&lt;/p&gt;

</content></entry><entry><id>datapioneer:Hk4eAxCKr</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/Hk4eAxCKr?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Linux Unix Tech Channel</title><published>2019-10-23T16:21:00.245Z</published><updated>2019-10-23T16:25:31.095Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://teletype.in/files/4e/4e3d8f66-8d5f-4063-8822-45e2b0f03c97.png"></media:thumbnail><category term="links" label="Links"></category><summary type="html">&lt;img src=&quot;https://teletype.in/files/4e/4e3d8f66-8d5f-4063-8822-45e2b0f03c97.png&quot;&gt;The link to my YouTube Channel is: https://www.youtube.com/user/dlcalloway/</summary><content type="html">
  &lt;p&gt;The link to my YouTube Channel is: &lt;a href=&quot;https://www.youtube.com/user/dlcalloway/videos?view_as=subscriber&quot; target=&quot;_blank&quot;&gt;https://www.youtube.com/user/dlcalloway/&lt;/a&gt;&lt;/p&gt;
  &lt;figure class=&quot;m_retina&quot;&gt;
    &lt;img src=&quot;https://teletype.in/files/4e/4e3d8f66-8d5f-4063-8822-45e2b0f03c97.png&quot; width=&quot;960&quot; /&gt;
  &lt;/figure&gt;

</content></entry><entry><id>datapioneer:BJoISLXFS</id><link rel="alternate" type="text/html" href="https://teletype.in/@datapioneer/BJoISLXFS?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=datapioneer"></link><title>Setting Up a NAS Solution Running in Debian Linux</title><published>2019-10-15T14:26:04.834Z</published><updated>2019-10-15T14:26:04.834Z</updated><category term="blog" label="Blog"></category><summary type="html">Recently, I setup a secondary network-attached storage (NAS) solution at home using a virtual machine rather than a bare metal PC/server as a test platform. The process for setting this up is rather easy and anyone can do it. As I stated here, this is a secondary NAS solution since I already have a 5TB WDMyCloud Personal Cloud which I have had in place in my home running on my LAN now for several years.</summary><content type="html">
  &lt;p&gt;Recently, I setup a secondary network-attached storage (NAS) solution at home using a virtual machine rather than a bare metal PC/server as a test platform. The process for setting this up is rather easy and anyone can do it. As I stated here, this is a secondary NAS solution since I already have a 5TB WDMyCloud Personal Cloud which I have had in place in my home running on my LAN now for several years.&lt;/p&gt;
  &lt;p&gt;I have Virtualbox 6.0 Manager running on my Windows 10 Pro main PC from which I created my virtual environment of an application called OpenMediaVault. This application runs on Debian Linux and can be downloaded from &lt;a href=&quot;https://www.openmediavault.org/?page_id=77&quot; target=&quot;_blank&quot;&gt;OpenMediaVault&amp;#x27;s download page&lt;/a&gt;. There is a link on this page to the ISO images that you can select from to get started. In my particular test case in Virtualbox 6.0 Manager, I selected the 5.0.5 image. If, however, you are electing to install OpenMediaVault on a Raspberry Pi 3 or 4 device, then you will want to elect to download and install the Raspberry Pi Images onto an SD Card and insert it in the Pi to install and utilize your Raspberry Pi device for this purpose. Since this is a test project for me so I can see how OpenMediaVault works and decide whether I want to use it as a secondary NAS solution, I chose the former rather than the latter ISO image.&lt;/p&gt;
  &lt;p&gt;Rather than describe all the necessary steps that I used to download, install, and configure OpenMediaVault as a VM in Virtualbox 6.0 Manager on my Windows 10 Pro platform, I will, instead, point you to the video that walks you through the entire process. If you have questions about this process after watching the video, then please leave a comment below this article and I will attempt to answer any questions as I get to them.&lt;/p&gt;
  &lt;figure class=&quot;m_column&quot;&gt;
    &lt;iframe src=&quot;https://www.youtube.com/embed/VmMyZj_wpeM?autoplay=0&amp;loop=0&amp;mute=0&quot;&gt;&lt;/iframe&gt;
  &lt;/figure&gt;

</content></entry></feed>