<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ZFS on GpMidi.Net - Beard Stuff</title><link>https://www.gpmidi.net/tags/zfs/</link><description>Recent content in ZFS on GpMidi.Net - Beard Stuff</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 10 Oct 2019 13:44:35 +0000</lastBuildDate><atom:link href="https://www.gpmidi.net/tags/zfs/index.xml" rel="self" type="application/rss+xml"/><item><title>Stupid Simple Python Script For Working With System vs ZFS Disks</title><link>https://www.gpmidi.net/posts/2019/stupid-simple-python-script-for-working-with-system-vs-zfs-d/</link><pubDate>Thu, 10 Oct 2019 13:42:48 +0000</pubDate><guid>https://www.gpmidi.net/posts/2019/stupid-simple-python-script-for-working-with-system-vs-zfs-d/</guid><description>&lt;p&gt;This script helps identify what disks are in use (or not in use) by ZFS. It's a stupid-simple python 3 script that requires only 'sh'. You can get that via 'pip3 install sh'. &lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;#!/usr/bin/python3&lt;br/&gt;&#13;&#10;import re&lt;br/&gt;&#13;&#10;from sh import zpool,lsblk,ls&lt;br/&gt;&#13;&#10;from pprint import pprint&lt;/p&gt;&#10;&lt;p&gt;print("Finding all disks")&lt;br/&gt;&#13;&#10;sdisks = str(lsblk('-d').stdout)&lt;br/&gt;&#13;&#10;# sdbl  67:240  0   7.3T  0 disk&lt;br/&gt;&#13;&#10;alldisks = re.findall(r'(sd[a-z]+)\s+\d+:\d+\s+\d+\s+(.*?)\s+\d+\s+disk',sdisks,re.MULTILINE)&lt;br/&gt;&#13;&#10;print("Found %d disks on system"%len(alldisks))&lt;/p&gt;&#10;&lt;p&gt;print("Finding ZFS disks")&lt;br/&gt;&#13;&#10;status=str(zpool.status("-LP").stdout)&lt;br/&gt;&#13;&#10;zdisks=re.findall(r'(/dev/sd[a-z]+)(\d)',status)&lt;br/&gt;&#13;&#10;print("Found %d ZFS disks"%len(zdisks))&lt;/p&gt;</description></item></channel></rss>