Continuing from Part 1, in this second part of the tutorial we’ll learn how to create ZFS storage pools with different RAID levels. For demonstration purpose, we have added 9 virtual HDDs to our system with 1 GB capacity each. Let’s install ‘lsscsi’ utility to list these HDDs.
1. Issue the following command at the terminal to install ‘lsscsi’ –
sudo apt-get install lsscsi
2. After ‘lsscsi’ has been installed, issue the following command at the terminal to list the HDDs attached –
lsscsi
3. The 9 HDDs are /dev/sdb, /dev/sdc, /dev/sdd, /dev/sde, /dev/sdf, /dev/sdg, /dev/sdh, /dev/sdi and /dev/sdj. Each HDD has 1 GB capacity. We’ll use /dev/sdb, /dev/sdc to create a ZFS pool called ‘MyPool1’ with RAID 1 (mirror). Then we’ll use /dev/sdd, /dev/sde, /dev/sdf to create a ZFS pool called ‘MyPool2’ with RAID 5 (RAID-Z). We’ll also create a third pool called ‘MyPool3’ with RAID 6 (RAID-Z2) using /dev/sdg, /dev/sdh, /dev/sdi and /dev/sdj.
The command syntax for creating ZFS pool is –
sudo zpool create <Pool Name> <Raid Level> <First storage device> <Second storage device> …. <Nth storage device>
To create ‘MyPool1’ we’ll issue the following command at the terminal –
sudo zpool create MyPool1 mirror /dev/sdb /dev/sdc
To create ‘MyPool2’ we’ll issue the following command at the terminal –
sudo zpool create MyPool2 raidz /dev/sdd /dev/sde /dev/sdf
To create ‘MyPool3’ we’ll issue the following command at the terminal –
sudo zpool create MyPool3 raidz2 /dev/sdg /dev/sdh /dev/sdi /dev/sdj
4. To view the status of the ZFS pools we’ll issue the following command at the terminal –
sudo zpool status | more
The above command lists the name of the ZFS pools, their state, if a scrub is in progress (scrub is data repairing utility for ZFS, just like fsck in Linux or chkdsk in Windows), RAID level of the ZFS pool, state of all the drives in the ZFS pool and also reports any Read / Write / Checksum errors for the ZFS pools and the individual drives.
5. To verify the capacity of the ZFS pools, issue the following command at the terminal –
sudo zfs list
The above command will list out all the ZFS pools, their used capacity, available capacity and referred capacity (amount of actual data stored not considering the compression and deduplication). Further more the above command also shows the mount points of the ZFS pools. Note that the ZFS pools created were automatically mounted on the Linux filesystem at ‘/MyPool1’, ‘/MyPool2’ and ‘/MyPool3’ respectively. We did not have to create them manually! The above commands also list out any ZFS datasets but as of yet, we haven’t created any.
Also note that the mirror (RAID 1) will give you 50% of the total capacity of the drives in the ZFS pool and tolerance for single drive failure. Hence, the capacity of MyPool1 is around 1 GB.
RAID-Z (RAID 5) will give you the total capacity of (N-1) drives of the N drives in the ZFS pool and tolerance for single drive failure. Hence, the capacity of MyPool2 is around 2 GB.
RAID-Z2 (RAID 6) will give you the total capacity of (N-2) drives of the N drives in the ZFS pool and tolerance for failure of up to 2 drives. Hence, the capacity of MyPool3 is around 2 GB.
You can also view the mount points in Nautilus and the available capacity for each mount point –
[To be continued in Part3…]
[…] on July 09, 2012 with No Comments Continuing from Part 2, in this third part of the tutorial, well learn how to create ZFS storage pools with RAID 10, RAID […]
[…] [To be continued in Part 2…] […]