<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>File-Systems on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/file-systems/</link><description>Recent content in File-Systems on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Sat, 29 Jul 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/file-systems/index.xml" rel="self" type="application/rss+xml"/><item><title>ZFS Basics on Proxmox</title><link>https://blog.iankulin.com/zfs-basics-on-proxmox/</link><pubDate>Sat, 29 Jul 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/zfs-basics-on-proxmox/</guid><description>&lt;p&gt;I&amp;rsquo;m a keen listener of the &lt;a href="https://2.5admins.com/"&gt;2.5 Admins&lt;/a&gt; podcast in which there&amp;rsquo;s frequent enumeration of the advantages of &lt;a href="https://itsfoss.com/what-is-zfs/"&gt;ZFS&lt;/a&gt; as a file system. So much so, that I&amp;rsquo;ve had occasional twinges or regret about the money I spent on the Synology - although it has been boringly reliable and does everything I need.&lt;/p&gt;
&lt;p&gt;Proxmox has some built in support for ZFS, including through the web GUI. So I&amp;rsquo;ve been itching to give it a try.&lt;/p&gt;
&lt;p&gt;I had a 256GB M2 NVME sitting around - I bought it with the plan to try it as the root drive in one of the servers. That was when I was worried that one of the servers&amp;rsquo; drives was about dead because the SMART data said it was at 100% use. I&amp;rsquo;ve since discovered that various companies interpret that different ways, so probably it&amp;rsquo;s 100% okay.&lt;/p&gt;
&lt;p&gt;I started to think a little &lt;a href="https://www.techtarget.com/searchstorage/definition/JBOD"&gt;JBOD&lt;/a&gt; with a couple of NVME SSD mirrored drives would be a fun project. There&amp;rsquo;s no way I could do that inside the case to get the proper PCI access, but the my HP 800 G2&amp;rsquo;s all have USB 3 so it shouldn&amp;rsquo;t be terrible - probably a lot better than the spinning rust NAS over 1GB Ethernet.&lt;/p&gt;
&lt;p&gt;I purchased this little UNITEK S1206A dual bay enclosure and another stick of 256GB Samsung SSD.&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/img_5742.jpg" width="600" alt=""&gt;
&lt;img src="https://blog.iankulin.com/images/s-l960.jpg" width="600" alt=""&gt;
&lt;p&gt;The instructions for the unit show sticking a layer of silicon over the top of the gum sticks, and then a thin piece of aluminum. I&amp;rsquo;ve heard these get hot, but it wasn&amp;rsquo;t clear to me if I should peel that paper off first. So I&amp;rsquo;ve done nothing for the moment while I do some more research.&lt;/p&gt;
&lt;p&gt;The process of getting it set up in Proxmox was simple. If you select the node in the web interface, and go in to &lt;em&gt;Disks&lt;/em&gt;, you can see a list of the physical disks attached. The NVME drives showed up as NTFS so I wiped them by selecting the drive and pressing the &lt;em&gt;Wipe Disk&lt;/em&gt; button.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-04-at-6.19.00-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;You can see on the screenshot above, that further down in the Disks list it says ZFS. That&amp;rsquo;s where you go to create the ZFS pool. I probably need to pause here, and go over some of the ZFS terminology.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.victormendonca.com/2020/11/03/zfs-for-dummies/"&gt;&lt;img src="https://blog.iankulin.com/images/zfs-components-1.png" width="706" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To start in the middle, we have the concept of a ZFS Pool. This is, well, a pool of storage that&amp;rsquo;s available to be used. It has a size, and we can see how much space is available. The pool is made up of vdev (virtual devices). A vdev could be a single physical drive, or multiple drives in some kind of RAID arrangement.&lt;/p&gt;
&lt;p&gt;In my situation, with the two NVME drives, my zpool will be made up of a single vdev comprising two physical drives which have been mirrored.&lt;/p&gt;
&lt;p&gt;In the zpool, we can create &lt;em&gt;datasets&lt;/em&gt; where we can actually put some data. You can think of these as directories in the sense they have a name and we can create directories and store data inside them, but in ZFS, the datasets in a zpool can have different settings (such as compression, de-duplication) applied to them. This is also the level where snapshots can be taken for backups.&lt;/p&gt;
&lt;p&gt;To create the ZFS pool in Proxmox, again select the node, then select ZFS in the list under &lt;em&gt;Disks&lt;/em&gt;. At the top is a button for &lt;em&gt;Create ZFS&lt;/em&gt;. Select the wiped drives, chose your RAID and give it a name. By tradition the pools are usually called &amp;rsquo;tank&amp;rsquo; - if you look at a few tutorials you&amp;rsquo;ll see that all over the place.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-04-at-8.26.42-pm.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;Once that was done, tank appeared as storage in the list under my node. I moved the drives of these dev guests across to it so the zpool would have something to do. I did notice that this process would rush through, then pause for a few seconds - something I haven&amp;rsquo;t noticed when moving guest droves between the NAS and internal SSDs. Early reviews of Samsung pm981 NVME SSD &lt;a href="https://www.tomshardware.com/reviews/samsung-pm981-980-nvme-ssd,5323.html"&gt;noted a sustained write dropoff&lt;/a&gt;, so this might be something to come back and have a look at later.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-04-at-8.23.10-pm.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;If we drop into the shell now, we can have a look at the datasets.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# zfs list
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NAME USED AVAIL REFER MOUNTPOINT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank 32.0G 199G 96K /tank
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-300-disk-0 16.5G 209G 6.04G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-321-disk-0 5.16G 202G 1.67G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-322-disk-0 5.16G 202G 1.62G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-323-disk-0 5.16G 202G 1.60G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So my pool is &lt;code&gt;tank&lt;/code&gt;, and there&amp;rsquo;s been datasets created for each of the VM guests&amp;rsquo; disks. We can create a data set to start using the pool as well.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;zfs create tank/temp_set
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That creates a dataset called &lt;code&gt;temp_set&lt;/code&gt; in the &lt;code&gt;tank&lt;/code&gt; zpool. It will have been mounted for us too. Let&amp;rsquo;s create a 1 GB file in there.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# cd /tank/temp_set
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/tank/temp_set# head -c 1G &amp;lt;/dev/urandom &amp;gt;myfile
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/tank/temp_set# ls
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;myfile
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then if we list the datasets again.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/tank/temp_set# zfs list
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;NAME USED AVAIL REFER MOUNTPOINT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank 33.0G 198G 104K /tank
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/temp_set 1.00G 198G 1.00G /tank/temp_set
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-300-disk-0 16.5G 208G 6.04G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-321-disk-0 5.16G 201G 1.67G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-322-disk-0 5.16G 201G 1.62G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tank/vm-323-disk-0 5.16G 201G 1.60G -
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/tank/temp_set# 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you&amp;rsquo;ve created a dataset, you can just use it as a regular place to store stuff. ZFS will go on doing it&amp;rsquo;s magic in the background to keep your data safe with copy-on-write and other magic. It&amp;rsquo;s good ZFS practice to do a &lt;em&gt;scrub&lt;/em&gt; every now and then. This causes ZFS to use whatever information it&amp;rsquo;s got to check the integrity of all your data.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# zpool scrub tank
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# zpool status -v tank
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; pool: tank
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; state: ONLINE
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; scan: scrub repaired 0B in 00:00:53 with 0 errors on Tue Jul 4 20:58:16 2023
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;config:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; NAME STATE READ WRITE CKSUM
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; tank ONLINE 0 0 0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; mirror-0 ONLINE 0 0 0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sdb ONLINE 0 0 0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sdc ONLINE 0 0 0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;errors: No known data errors
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@pve-prod1:/# 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;While I&amp;rsquo;ve been writing this post, I&amp;rsquo;ve been copying data to and fro (I&amp;rsquo;d try things out, then have to delete and repeat to get the screen shot I wanted, and at one stage I decided to change the name of the zpool so all the disk images had to be moved off then back on after I&amp;rsquo;d recreated it etc) for about 90 minutes, and I&amp;rsquo;ve just been in the server rooms to see if the external NVME enclosure is hot. It&amp;rsquo;s warm to the touch, I&amp;rsquo;d guess 40° - so not alarming for this level of use. That box is pretty well ventilated.&lt;/p&gt;
&lt;p&gt;If you want a good summary of ZFS, particularly the thinking behind it, this is a great overview.&lt;/p&gt;
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"&gt;
 &lt;iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/lsFDp-W1Ks0?autoplay=0&amp;amp;controls=1&amp;amp;end=0&amp;amp;loop=0&amp;amp;mute=0&amp;amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"&gt;&lt;/iframe&gt;
 &lt;/div&gt;
</description></item></channel></rss>