Check installed drives by running:
sudo fdisk -l
returns:
Disk /dev/sdb: 14.57 TiB, 16000900661248 bytes, 31251759104 sectors Disk model: ST16000NM001G-2K Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/sdc: 14.57 TiB, 16000900661248 bytes, 31251759104 sectors Disk model: ST16000NM001G-2K Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes
NOTE: Note down the device names of drives you want to pool.
Another method to check the disks:
lsblk -S
returns:
NAME HCTL TYPE VENDOR MODEL REV TRAN sdb 5:0:0:0 disk ATA ST16000NM001G-2KK103 SN02 sata sdc 8:0:0:0 disk ATA ST16000NM001G-2KK103 SN02 sata
WARNING: Ensure that the disk with the Ubuntu operating system is not used.
Delete all partitions and reset it:
sudo sgdisk - -zap-all /dev/sdb
Create a partition with 1GB of trailing free space:
sudo sgdisk -n1:0:-1G -t1:BF00 /dev/sdb
NOTE: Adjust these values as required.
NOTE: This will result in a /dev/sdb1 partition being created.
Different types of storage pools can be created:
sudo zpool create testpool /dev/sdb /dev/sdc
NOTE: This is equivalent to RAID0.
sudo zpool create testpool mirror /dev/sdb /dev/sdc
NOTE: Much like RAID1, one can use 2 or more VDEVs.
sudo zpool create example mirror /dev/sdb /dev/sdc mirror /dev/sdd /dev/sde or sudo zpool create example mirror /dev/sdb /dev/sdc sudo zpool add example mirror /dev/sdd /dev/sde
NOTE: Much like RAID10.
sudo zpool create testpool mirror /dev/sdb /dev/sdc sudo zpool create example raidz /dev/sdb /dev/sdc /dev/sdd /dev/sde
NOTE: Like RAID5.
sudo zpool create example raidz2 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
NOTE: Like RAID6.
sudo zpool create example raidz3 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg
NOTE: Better than RAID6.
sudo zpool create example raidz /dev/sdb /dev/sdc /dev/sdd /dev/sde sudo zpool add example raidz /dev/sdf /dev/sdg /dev/sdh /dev/sdi
NOTE: Like RAID50, RAID60, striped RAIDZ volumes.
NOTE: Here, entire disks are being used for the pool.
NOTE: The newly mounted pool will appear as any other part of the filesystem.
sudo zpool create -m /mnt/testpool testpool mirror /dev/sdb /dev/sdc
NOTE: If any error appears, the command can be rerun with the -f option after the zpool create command which forces the command to be executed:
sudo zpool create -f testpool /dev/sdb /dev/sdd
NOTE: Advanced options can also be used when creating a pool.
sudo zpool create -f -o ashift=12 -O compression=lz4 my_pool /dev/sdb1
Check the Mount is showing:
df -h
By default only root can write to the mounted directory.
Change this so that any ordinary user can make changes to the directory:
sudo chown -Rfv peter:peter /testpool
sudo zpool status