/ zfs

Ubuntu 16.04 - Using Files To Test ZFS

It's good to practice using a tool before actually "going live" with it. Sometimes we don't have disks/computers lying around to be able to set up a dev ZFS RAID array to experiment with, so this tutorial is simply here to show you how to get started with ZFS using files to act as virtual disks.

Don't use this for anything other than testing/playing.


Install ZFS if you haven't already.

Now lets create our fake disks, which we will build our ZFS pool out of. These will be sparse files that can grow up to 10G each. If you need to create a RAIDz, then go ahead and add at least one more file to the list.

truncate --size 10G disk1.img disk2.img

Now create the pool out of your disks.

sudo zpool create pool1 \
`pwd`/disk1.img \

If that was successful, you should be able to execute the following command:

sudo zpool list

and get the following output...

pool1  19.9G  68.5K  19.9G         -     0%     0%  1.00x  ONLINE  -

Now use the ZFS cheatsheet to play your pool in any way that you see fit, such as creating datasets, snapshots, etc.

When you are done testing, delete your datasets and pool with:

sudo zfs destroy -r pool1
sudo zpool destroy pool1


Stuart Page

Stuart Page

Stuart is a software developer with a passion for Linux and open source projects.

Read More