As discussed in [Part 1][1] and [Part 2][2] of this series, Stratis is a volume-managing filesystem with functionality similar to that of [ZFS][3] and [Btrfs][4]. In this article, we'll walk through how to use Stratis on the command line.
### Getting Stratis
For non-developers, the easiest way to try Stratis now is in [Fedora 28][5].
Once you're running this, you can install the Stratis daemon and the Stratis command-line tool with:
```
# dnf install stratis-cli stratisd
```
### Creating a pool
Stratis has three concepts: blockdevs, pools, and filesystems. Blockdevs are the block devices, such as a disk or a disk partition, that make up a pool. Once a pool is created, filesystems can be created from it.
Assuming you have a block device called `vdg` on your system that is not currently in use or mounted, you can create a Stratis pool on it with:
```
# stratis pool create mypool /dev/vdg
```
This assumes `vdg` is completely zeroed and empty. If it is not in use but has old data on it, it may be necessary to use `pool create`'s `- force` option. If it is in use, don't use it for Stratis.
If you want to create a pool from more than one block device, just list them all on the `pool create` command line. You can also add more blockdevs later using the `blockdev add-data` command. Note that Stratis requires blockdevs to be at least 1 GiB in size.
### Creating filesystems
Once you've created a pool called `mypool`, you can create filesystems from it:
```
# stratis fs create mypool myfs1
```
After creating a filesystem called `myfs1` from pool `mypool`, you can mount and use it, using the entries Stratis has created within /dev/stratis:
```
# mkdir myfs1
# mount /dev/stratis/mypool/myfs1 myfs1
```
The filesystem is now mounted on `myfs1` and ready to use.
### Snapshots
In addition to creating empty filesystems, you can also create a filesystem as a snapshot of an existing filesystem:
After doing so, you could mount the new `myfs1-experiment`, which will initially contain the same file contents as `myfs1`, but could change as the filesystem is modified. Whatever changes you made to `myfs1-experiment` would not be reflected in `myfs1` unless you unmounted `myfs1` and destroyed it with:
```
# umount myfs1
# stratis fs destroy mypool myfs1
```
and then snapshotted the snapshot to recreate it and remounted it:
As filesystems have more data written to them, you will see the "Total Physical Used" value increase. Be careful when this approaches "Total Physical Size"; we're still working on handling this correctly.
To list filesystems within a pool:
```
# stratis fs list mypool
```
To list the blockdevs that make up a pool:
```
# stratis blockdev list mypool
```
These give only minimal information currently, but they will provide more in the future.
#### Destroying a pool
Once you have an idea of what Stratis can do, to destroy the pool, first make sure all filesystems created from it are unmounted and destroyed, then use the `pool destroy` command:
```
# umount myfs1
# umount myfs1-experiment (if you created it)
# stratis fs destroy mypool myfs1
# stratis fs destroy mypool myfs1-experiment
# stratis pool destroy mypool
```
`stratis pool list` should now show no pools.
That's it! For more information, please see the manpage: `man stratis`.