Sick Gaming
Fedora - Getting started with Stratis – up and running - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Computers (https://www.sickgaming.net/forum-86.html)
+--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html)
+--- Thread: Fedora - Getting started with Stratis – up and running (/thread-98539.html)



Fedora - Getting started with Stratis – up and running - xSicKxBot - 12-01-2020

Getting started with Stratis – up and running

<div><p>When adding storage to a Linux server, system administrators often use commands like <em>pvcreate</em>, <em>vgcreate</em>, <em>lvcreate</em>, and <em>mkfs</em> to integrate the new storage into the system.&nbsp;<a href="https://stratis-storage.github.io/" target="_blank" rel="noreferrer noopener">Stratis</a> is a command-line tool designed to make managing storage much simpler. It creates, modifies, and destroys pools of storage. It also allocates and deallocates filesystems from the storage pools.</p>
<p> <span id="more-32160"></span> </p>
<p>Instead of an entirely in-kernel approach like ZFS or Btrfs, Stratis uses a hybrid approach with components in both user space and kernel land. It builds on existing block device managers like device mapper and existing filesystems like XFS. Monitoring and control is performed by a user space daemon.</p>
<p>Stratis tries to avoid some ZFS characteristics like restrictions on adding new hard drives or replacing existing drives with bigger ones. One of its main design goals is to achieve a positive command-line experience.</p>
<h2>Install Stratis</h2>
<p>Begin by installing the required packages. Several Python-related dependencies will be automatically pulled in. The <em>stratisd</em> package provides the <em>stratisd</em> daemon which creates, manages, and monitors local storage pools. The <em>stratis-cli</em> package provides the <em>stratis</em> command along with several Python libraries.</p>
<pre class="wp-block-preformatted"># yum install -y stratisd stratis-cli</pre>
<p>Next, enable the <em>stratisd</em> service.</p>
<pre class="wp-block-preformatted"># systemctl enable --now stratisd</pre>
<p>Note that the “enable –now” syntax shown above both permanently enables and immediately starts the service.</p>
<p>After determining what disks/block devices are present and available, the three basic steps to using Stratis are:</p>
<ol>
<li>Create a pool of the desired disks.</li>
<li>Create a filesystem in the pool.</li>
<li>Mount the filesystem.</li>
</ol>
<p>In the following example, four virtual disks are available in a virtual machine. Be sure not to use the root/system disk (/dev/vda in this example)!</p>
<pre class="wp-block-preformatted"># sfdisk -s
/dev/vda: 31457280
/dev/vdb: &nbsp; 5242880
/dev/vdc: &nbsp; 5242880
/dev/vdd: &nbsp; 5242880
/dev/vde: &nbsp; 5242880
total: 52428800 blocks</pre>
<h2>Create a storage pool using Stratis</h2>
<pre class="wp-block-preformatted"># stratis pool create testpool /dev/vdb /dev/vdc
# stratis pool list
Name Total Physical Size&nbsp; Total Physical Used
testpool 10 GiB 56 MiB</pre>
<p>After creating the pool, check the status of its block devices:</p>
<pre class="wp-block-preformatted"># stratis blockdev list
Pool Name &nbsp; Device Node Physical Size &nbsp; State&nbsp; Tier
testpool&nbsp; /dev/vdb&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use&nbsp; Data
testpool&nbsp; /dev/vdc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use&nbsp; Data</pre>
<h2>Create a filesystem using Stratis</h2>
<p>Next, create a filesystem. As mentioned earlier, Stratis uses the existing DM (device mapper) and XFS filesystem technologies to create thinly-provisioned filesystems. By building on these existing technologies, large filesystems can be created and it is possible to add physical storage as storage needs grow.</p>
<pre class="wp-block-preformatted"># stratis fs create testpool testfs
# stratis fs list
Pool Name &nbsp;Name&nbsp; Used Created&nbsp; &nbsp; &nbsp; &nbsp; Device&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UUID
testpool&nbsp; testfs&nbsp;546 MiB&nbsp; Apr 18 2020 09:15 /stratis/testpool/testfs&nbsp; 095fb4891a5743d0a589217071ff71dc</pre>
<p>Note that “fs” in the example above can optionally be written out as “filesystem”.</p>
<h2>Mount the filesystem</h2>
<p>Next, create a mount point and mount the filesystem.</p>
<pre class="wp-block-preformatted"># mkdir /testdir
# mount /stratis/testpool/testfs /testdir
# df -h | egrep 'stratis|Filesystem'
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/stratis-1-3e8e[truncated]71dc&nbsp; 1.0T&nbsp; 7.2G 1017G &nbsp; 1% /testdir</pre>
<p>The actual space used by a filesystem is shown using the <em>stratis fs list</em> command demonstrated previously. Notice how the <em>testdir</em> filesystem has a virtual size of <strong>1.0T</strong>. If the data in a filesystem approaches its virtual size, and there is available space in the storage pool, Stratis will automatically grow the filesystem. Note that beginning with Fedora 34, the form of device path will be <em>/dev/stratis/&lt;pool-name&gt;/&lt;filesystem-name&gt;</em>.</p>
<h2>Add the filesystem to fstab</h2>
<p>To configure automatic mounting of the filesystem at boot time, run following commands:</p>
<pre class="wp-block-preformatted"># UUID=`lsblk -n -o uuid /stratis/testpool/testfs`
# echo "UUID=${UUID} /testdir xfs defaults 0 0" &gt;&gt; /etc/fstab</pre>
<p>After updating fstab, verify that the entry is correct by unmounting and mounting the filesystem:</p>
<pre class="wp-block-preformatted"># umount /testdir
# mount /testdir
# df -h | egrep 'stratis|Filesystem'
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/stratis-1-3e8e[truncated]71dc&nbsp; 1.0T&nbsp; 7.2G 1017G &nbsp; 1% /testdir</pre>
<h2>Adding cache devices with Stratis</h2>
<p>Suppose <em>/dev/vdd</em> is an available SSD (solid state disk). To configure it as a cache device and check its status, use the following commands:</p>
<pre class="wp-block-preformatted"># stratis pool add-cache testpool&nbsp; /dev/vdd
# stratis blockdev
Pool Name&nbsp; &nbsp;Device Node Physical Size &nbsp;State &nbsp; Tier
testpool &nbsp; /dev/vdb&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use &nbsp; Data
testpool &nbsp; /dev/vdc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use &nbsp; Data
testpool &nbsp; /dev/vdd&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use&nbsp; Cache</pre>
<h2>Growing the storage pool</h2>
<p>Suppose the <em>testfs</em> filesystem is close to using all the storage capacity of <em>testpool</em>. You could add an additional disk/block device to the pool with commands similar to the following:</p>
<pre class="wp-block-preformatted"># stratis pool add-data testpool /dev/vde
# stratis blockdev
Pool Name Device Node Physical Size &nbsp; State &nbsp; Tier
testpool &nbsp; /dev/vdb &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use &nbsp; Data
testpool &nbsp; /dev/vdc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use &nbsp; Data
testpool &nbsp; /dev/vdd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use&nbsp; Cache
testpool &nbsp; /dev/vde &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 GiB&nbsp; In-use &nbsp; Data</pre>
<p>After adding the device, verify that the pool shows the added capacity:</p>
<pre class="wp-block-preformatted"># stratis pool
Name&nbsp; &nbsp; &nbsp; Total Physical Size &nbsp; Total Physical Used
testpool &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 15 GiB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 606 MiB</pre>
<h2>Conclusion</h2>
<p>Stratis is a tool designed to make managing storage much simpler.&nbsp;Creating a filesystem with enterprise functionalities like thin-provisioning, snapshots, volume management, and caching can be accomplished quickly and easily with just a few basic commands.</p>
<p>See also <a href="https://fedoramagazine.org/getting-started-with-stratis-encryption/">Getting Started with Stratis Encryption</a>.</p>
</div>


https://www.sickgaming.net/blog/2020/11/30/getting-started-with-stratis-up-and-running/