zfs:pools:create_a_zfs_pool
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zfs:pools:create_a_zfs_pool [2021/10/13 20:33] – [To create a Striped Mirrored VDEVs] peter | zfs:pools:create_a_zfs_pool [2021/10/13 21:52] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ZFS - Pools - Create a ZFS Pool ====== | ====== ZFS - Pools - Create a ZFS Pool ====== | ||
- | ===== Choose Drives to Pool ===== | ||
- | Check installed drives by running: | ||
- | |||
- | <code bash> | ||
- | sudo fdisk -l | ||
- | </ | ||
- | |||
- | returns: | ||
- | |||
- | <code bash> | ||
- | Disk /dev/sdb: 14.57 TiB, 16000900661248 bytes, 31251759104 sectors | ||
- | Disk model: ST16000NM001G-2K | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | |||
- | Disk /dev/sdc: 14.57 TiB, 16000900661248 bytes, 31251759104 sectors | ||
- | Disk model: ST16000NM001G-2K | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | </ | ||
- | |||
- | Another method to check the disks: | ||
- | |||
- | <code bash> | ||
- | lsblk -S | ||
- | </ | ||
- | |||
- | returns: | ||
- | |||
- | <code bash> | ||
- | NAME HCTL TYPE VENDOR | ||
- | sdb 5: | ||
- | sdc 8: | ||
- | </ | ||
- | |||
- | <WRAP important> | ||
- | **WARNING: | ||
- | |||
- | * Also exclude any other disks that may contain data not to be destroyed. | ||
- | |||
- | </ | ||
---- | ---- | ||
- | ===== Delete Existing Partitions if required ===== | + | [[ZFS: |
- | Delete all partitions and reset it: | + | [[ZFS:Pools: |
- | <code bash> | + | [[ZFS: |
- | sudo sgdisk | + | |
- | </ | + | |
+ | [[ZFS: | ||
- | Create a partition with 1GB of trailing free space: | + | [[ZFS: |
- | <code bash> | + | [[ZFS:Pools:Create a ZFS Pool:RAID Z3|RAID Z3]] |
- | sudo sgdisk -n1:0:-1G -t1:BF00 /dev/sdb | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | </ | + | |
---- | ---- | ||
- | ===== Creating | + | [[ZFS: |
- | Different types of storage pools can be created: | + | [[ZFS:Pools: |
- | ==== To create a striped pool ==== | + | [[ZFS:Pools: |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create testpool /dev/sdb /dev/sdc | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE:** This is equivalent to RAID0. | + | |
- | + | ||
- | * This has no parity and no mirroring to rebuild the data. | + | |
- | * This is not recommended because of the risk of losing data if a drive fails. | + | |
- | + | ||
- | </ | + | |
---- | ---- | ||
- | ==== To create a mirrored pool ==== | + | [[ZFS:Pools:Create a ZFS Pool:Comprehensive Steps to Create |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create testpool mirror /dev/sdb /dev/sdc | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE:** Much like RAID1, one can use 2 or more VDEVs. | + | |
- | + | ||
- | * For N VDEVs, one will have to have N-1 fail before data is lost. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== To create a Striped Mirrored VDEVs ==== | + | |
- | + | ||
- | <code bash> | + | |
- | 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 | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * Great for small random read I/O. | + | |
- | * Create | + | |
- | * This creates striped 2 x 2 mirrored pool. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== To create | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create testpool mirror /dev/sdb /dev/sdc | + | |
- | sudo zpool create example raidz /dev/sdb /dev/sdc /dev/sdd /dev/sde | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE:** Like RAID5. | + | |
- | + | ||
- | * This uses a variable width strip for parity. | + | |
- | * Allows one to get the most capacity out of a bunch of disks with parity checking with a sacrifice | + | |
- | * Allows | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== To create a RAIDZ2 pool ==== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create example raidz2 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * Has double the parity for 2 disk failures with performance similar to RAIDZ. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== To create a RAIDZ3 pool ==== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create example raidz3 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * Has 3 parity bits, allowing for 3 disk failures before losing data with performance like RAIDZ2 and RAIDZ. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== To create a Nested Raid pool ==== | + | |
- | + | ||
- | <code bash> | + | |
- | 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 | + | |
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * This is better performing than RAIDZ but at the cost of reducing capacity. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * ZFS also supports creating pools from disk partitions, such as / | + | |
- | * Anything with a descriptor in /dev that allows random access will work. | + | |
- | * Test pools made of sparse files are an incredibly convenient way to practice zpool commands. | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | * **testpool** is the name of the pool. | + | |
- | + | ||
- | * The newly created pool will be mounted at **/ | + | |
- | * You can select a different mount point using the **-m** option: <code bash> | + | |
- | sudo zpool create -m / | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create -f testpool /dev/sdb /dev/sdd | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | + | ||
- | <WRAP info> | + | |
- | **NOTE: | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool create -f -o ashift=12 -O compression=lz4 my_pool /dev/sdb1 | + | |
- | </ | + | |
- | + | ||
- | * **ashift**: | + | |
- | * **compression**: | + | |
- | * **my_pool**: | + | |
- | * **/ | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== List Mounts ===== | + | |
- | + | ||
- | Check the Mount is showing: | + | |
- | + | ||
- | <code bash> | + | |
- | df -h | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Set Permissions of the Mount ===== | + | |
- | + | ||
- | By default only root can write to the mounted directory. | + | |
- | + | ||
- | Change this so that any ordinary user can make changes to the directory: | + | |
- | + | ||
- | <code bash> | + | |
- | sudo chown -Rfv peter:peter /testpool | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ===== Check Pool Status ===== | + | |
- | + | ||
- | <code bash> | + | |
- | sudo zpool status | + | |
- | </ | + | |
- | + | ||
zfs/pools/create_a_zfs_pool.1634157196.txt.gz · Last modified: 2021/10/13 20:33 by peter