<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Zpool on inetshell</title><link>https://inet.sh/en/tags/zpool/</link><description>Recent content in Zpool on inetshell</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 19 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://inet.sh/en/tags/zpool/index.xml" rel="self" type="application/rss+xml"/><item><title>Import a ZFS pool after a power outage</title><link>https://inet.sh/en/posts/zfs/import-after-power-outage/</link><pubDate>Wed, 19 Aug 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/zfs/import-after-power-outage/</guid><description>Use zpool import -F and zpool import -f to import a dirty ZFS pool after a power cut, then scrub.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<p>Pool will not import after power loss: <code>zpool import -f</code>, then <code>-F</code> if you must rewind txgs, then <code>zpool scrub</code>.</p>
<p>After a power cut the pool is often still <strong>on the disks</strong> but <code>zpool status</code> is empty: it was left dirty-exported, or the host booted without it. Do not <code>zpool create</code> on those disks.</p>
<h2 id="see-what-is-there">See what is there</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool import
</span></span></code></pre></td></tr></table>
</div>
</div><p>Lists importable pools by name (<code>VOL1</code> below) and whether they are <code>FAULTED</code> / <code>UNAVAIL</code>.</p>
<h2 id="import">Import</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool import -f VOL1
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>-f</code> means “I know it might still look imported elsewhere”. That is the usual crash case: ZFS thinks the other side still holds it.</p>
<p>If <code>-f</code> is not enough because the last txgs were half-written:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool import -F VOL1
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>-F</code> <strong>rewinds</strong> to an earlier consistent txg. You can lose the last seconds of writes. That is better than a pool that will not mount.</p>
<p>Dry-run:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool import -F -n VOL1
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="afterwards-scrub">Afterwards: scrub</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool scrub VOL1
</span></span><span class="line"><span class="cl">zpool status VOL1
</span></span></code></pre></td></tr></table>
</div>
</div><p>Scrub confirms the rewind did not leave checksum errors. Let it finish before you delete “just in case” snapshots.</p>
<h2 id="do-not">Do not</h2>
<ul>
<li><code>zpool create</code> on the same <code>sdX</code> devices wipes the labels.</li>
<li><code>-F</code> is not the first knob: try <code>-f</code> first.</li>
<li>If the pool is the root (<code>rpool</code> / Proxmox <code>bpool</code>), import from live media, not from the system that will not boot.</li>
</ul>
<p>See also: <a href="/en/posts/zfs/replace-disks/">replacing disks</a>, <a href="/en/posts/zfs/basic-commands/">basic commands</a>.</p>
]]></content:encoded></item><item><title>Replace a disk in a ZFS pool</title><link>https://inet.sh/en/posts/zfs/replace-disks/</link><pubDate>Wed, 19 Aug 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/zfs/replace-disks/</guid><description>zpool replace -f to swap an OFFLINE or GUID disk on ZFS on Linux / Proxmox, then wait for resilver.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<p>OFFLINE disk: <code>zpool replace -f &lt;GUID&gt; /dev/disk/by-id/…</code> — GUID from <code>zpool status</code>, not <code>/dev/sdX</code>.</p>
<p>Proxmox documents the case: <a href="https://pve.proxmox.com/wiki/ZFS_on_Linux#sysadmin_zfs_change_failed_dev">ZFS on Linux — change a failed device</a>. The symptom is an <code>OFFLINE</code> / <code>FAULTED</code> vdev and a long number instead of <code>sde</code>.</p>
<h2 id="status">Status</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool status vol1
</span></span></code></pre></td></tr></table>
</div>
</div><p>The dead member often shows up as a GUID:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">1894156996840098641  OFFLINE
</span></span></code></pre></td></tr></table>
</div>
</div><p>That happens when the kernel no longer has a <code>/dev/sdX</code> for that disk (you yanked it, it died, or the letter moved).</p>
<h2 id="replace">Replace</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool replace -f vol1 <span class="m">1894156996840098641</span> /dev/disk/by-id/ata-NEWDISK
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>-f</code> forces if ZFS still “remembers” the old disk. The replacement must be <strong>at least</strong> the same size (prefer by-id, not <code>sde</code>).</p>
<p>If the new disk <strong>is</strong> in the same slot and ZFS sees it:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool replace vol1 /dev/disk/by-id/ata-OLDDISK /dev/disk/by-id/ata-NEWDISK
</span></span></code></pre></td></tr></table>
</div>
</div><p>or auto-detect a replacement in-place:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool replace vol1 /dev/disk/by-id/ata-OLDDISK
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="wait-for-resilver">Wait for resilver</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool status vol1
</span></span><span class="line"><span class="cl">watch -n <span class="m">5</span> zpool status vol1
</span></span></code></pre></td></tr></table>
</div>
</div><p>Do not reboot, export, or start another replace on the same vdev until <code>resilvered</code>. On RAIDZ1 you are one disk down: a second failure in that window is data loss.</p>
<h2 id="afterwards">Afterwards</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool detach vol1 <span class="m">1894156996840098641</span>   <span class="c1"># only if status still shows it as spare/old</span>
</span></span><span class="line"><span class="cl">zpool labelclear /dev/sdOLD             <span class="c1"># if you reuse the old disk elsewhere</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>See also: <a href="/en/posts/zfs/import-after-power-outage/">import after a power outage</a>.</p>
]]></content:encoded></item><item><title>ZFS command cheat sheet (pool, compression, cache, log)</title><link>https://inet.sh/en/posts/zfs/basic-commands/</link><pubDate>Wed, 19 Aug 2026 00:00:00 +0000</pubDate><guid>https://inet.sh/en/posts/zfs/basic-commands/</guid><description>ZFS cheat sheet: zpool create raidz, export/import, lz4 compression, L2ARC, SLOG, labelclear, and destroy.</description><content:encoded><![CDATA[<h2 id="tldr">TL;DR</h2>
<p>Cheat sheet: <code>zpool create</code>, export/import, <code>lz4</code>, L2ARC, SLOG, <code>labelclear</code>, destroy — the 2 a.m. set.</p>
<p>Short reference. Longer procedures are linked at the bottom.</p>
<h2 id="pool">Pool</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool create vol1 raidz sda sdb sdc
</span></span><span class="line"><span class="cl">zpool status vol1
</span></span><span class="line"><span class="cl">zpool <span class="nb">export</span> vol1
</span></span><span class="line"><span class="cl">zpool import -f vol1
</span></span><span class="line"><span class="cl">zpool destroy tank          <span class="c1"># irreversible</span>
</span></span><span class="line"><span class="cl">zpool labelclear ada0       <span class="c1"># wipe ZFS labels from a spare disk</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>raidz</code> here is RAIDZ1 (one parity). For two, <code>raidz2</code>. Address disks as <code>/dev/disk/by-id/…</code>, not <code>sdX</code>, which reorder.</p>
<h2 id="mountpoint">Mountpoint</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zfs unmount vol1
</span></span><span class="line"><span class="cl">zfs <span class="nb">set</span> <span class="nv">mountpoint</span><span class="o">=</span>/mnt/vol1 vol1
</span></span><span class="line"><span class="cl">zfs mount vol1
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="l2arc-cache-and-slog-zil">L2ARC (cache) and SLOG (ZIL)</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zpool add vol1 cache &lt;disk-id&gt;
</span></span><span class="line"><span class="cl">zpool add vol1 log &lt;disk-id&gt;
</span></span><span class="line"><span class="cl">zpool add vol1 log mirror &lt;disk-id-a&gt; &lt;disk-id-b&gt;
</span></span><span class="line"><span class="cl">zpool remove vol1 &lt;device&gt;
</span></span></code></pre></td></tr></table>
</div>
</div><p>Cache = hot reads. Log = sync writes (NFS, VMs). A “fast” USB SLOG is worse than no SLOG: if it dies mid-txg, you feel it. Mirror the log.</p>
<h2 id="compression">Compression</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">zfs <span class="nb">set</span> <span class="nv">compression</span><span class="o">=</span>lz4 newvol
</span></span><span class="line"><span class="cl">zfs <span class="nb">set</span> <span class="nv">compression</span><span class="o">=</span>off newvol
</span></span><span class="line"><span class="cl">zfs get compressratio newvol
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>lz4</code> is the sane default on modern OpenZFS. <code>zstd</code> compresses more and costs CPU. The property inherits to child datasets that do not override it.</p>
<h2 id="see-also">See also</h2>
<ul>
<li><a href="/en/posts/zfs/import-after-power-outage/">Import after a power outage</a></li>
<li><a href="/en/posts/zfs/replace-disks/">Replace disks</a></li>
<li><a href="/en/posts/zfs/encryption/">Native encryption</a></li>
</ul>
]]></content:encoded></item></channel></rss>