Setup ZFS file system in Ubuntu

ZFS file system allow you to take snapshot, this is great for backing up MySQL databases. Last day i setup 2 * 2 TB Hard disk on My PC as RAID 1 (mirror) using ZFS.

First install ZFS with

I created same size partition on both hard disks. You can use full disk if you want, but i created partition, so i can use first 100 GB of each disk for installing Operating system.

RAID 1

RAID 1 mirror data between 2 disks. Even if one of the disk die, your data will be safe.

To create RAID 1, run

Here sdx3 and sdy3 is partition on my HDD. Replace it with your actual partition to be used with ZFS. Be carefull not to use wrong partition or you will lose data.

If you are using full disk, then use

RAID 0

RAID 0 is dangerous, only use if you don’t care about data or you have a backup. If one of the disk fails, you will lose all data.

To setup RAID 0, use

Pool

Once you create a ZFS pool with “zpool” command, it get auto mounted as “/pool-name”. In above cause, i used name “tank”.

Here is what i have on my PC

The 2nd entry is the ZFS pool tank.

Datasets

Datasets are like partitions. You can create multiple partitions inside your pool, they sare disk space. You can set disk quotas if needed, by default no quota per datasets are set.

In above example /tank/data is a datasets i use.

To create a data set, run

Here “-o mountpoint” specify where you want to mount the new dataset.

zpool status

To see status for your ZFS file system, run

See zfs

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *