Science and technology

Using Stratis to handle Linux storage from the command line

As mentioned in Part 1 and Part 2 of this sequence, Stratis is a volume-managing filesystem with performance much like that of ZFS and Btrfs. In this text, we’ll stroll via learn how to use Stratis on the command line.

Getting Stratis

For non-developers, the simplest approach to attempt Stratis now’s in Fedora 28.

Once you are working this, you may set up the Stratis daemon and the Stratis command-line device with:

# dnf set up stratis-cli stratisd

Creating a pool

Stratis has three ideas: blockdevs, swimming pools, and filesystems. Blockdevs are the block gadgets, comparable to a disk or a disk partition, that make up a pool. Once a pool is created, filesystems will be created from it.

Assuming you’ve a block system referred to as vdg in your system that’s not presently in use or mounted, you may create a Stratis pool on it with:

# stratis pool create mypool /dev/vdg

This assumes vdg is totally zeroed and empty. If it’s not in use however has outdated knowledge on it, it could be mandatory to make use of pool create‘s - pressure possibility. If it is in use, do not use it for Stratis.

If you need to create a pool from multiple block system, simply record all of them on the pool create command line. You may add extra blockdevs later utilizing the blockdev add-data command. Note that Stratis requires blockdevs to be at the very least 1 GiB in dimension.

Creating filesystems

Once you’ve got created a pool referred to as mypool, you may create filesystems from it:

# stratis fs create mypool myfs1

After making a filesystem referred to as myfs1 from pool mypool, you may mount and use it, utilizing the entries Stratis has created inside /dev/stratis:

# mkdir myfs1
# mount /dev/stratis/mypool/myfs1 myfs1

The filesystem is now mounted on myfs1 and able to use.

Snapshots

In addition to creating empty filesystems, you can even create a filesystem as a snapshot of an present filesystem:

# stratis fs snapshot mypool myfs1 myfs1-experiment

After doing so, you could possibly mount the brand new myfs1-experiment, which can initially include the identical file contents as myfs1, however may change because the filesystem is modified. Whatever modifications you made to myfs1-experiment wouldn’t be mirrored in myfs1 until you unmounted myfs1 and destroyed it with:

# umount myfs1
# stratis fs destroy mypool myfs1

after which snapshotted the snapshot to recreate it and remounted it:

# stratis fs snapshot mypool myfs1-experiment myfs1
# mount /dev/stratis/mypool/myfs1 myfs1

Getting data

Stratis can record swimming pools on the system:

# stratis pool record

As filesystems have extra knowledge written to them, you will note the “Total Physical Used” worth enhance. Be cautious when this approaches “Total Physical Size”; we’re nonetheless engaged on dealing with this appropriately.

To record filesystems inside a pool:

# stratis fs record mypool

To record the blockdevs that make up a pool:

# stratis blockdev record mypool

These give solely minimal data presently, however they’ll present extra sooner or later.

Destroying a pool

Once you’ve an thought of what Stratis can do, to destroy the pool, first make certain all filesystems created from it are unmounted and destroyed, then use the pool destroy command:

# umount myfs1
# umount myfs1-experiment (should you created it)
# stratis fs destroy mypool myfs1
# stratis fs destroy mypool myfs1-experiment
# stratis pool destroy mypool

stratis pool record ought to now present no swimming pools.

That’s it! For extra data, please see the manpage: man stratis.

Most Popular

To Top