User Tools

Site Tools


zfs:pools:create_a_zfs_pool

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zfs:pools:create_a_zfs_pool [2021/10/12 23:39] – [Creating a Pool] peterzfs: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 
-</code> 
- 
-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/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 
-</code> 
- 
-<WRAP info> 
-**NOTE:**  Note down the device names of drives you want to pool. 
-</WRAP> 
- 
-Another method to check the disks: 
- 
-<code bash> 
-lsblk -S 
-</code> 
- 
-returns: 
- 
-<code bash> 
-NAME HCTL       TYPE VENDOR   MODEL                 REV TRAN 
-sdb  5:0:0:   disk ATA      ST16000NM001G-2KK103 SN02 sata 
-sdc  8:0:0:   disk ATA      ST16000NM001G-2KK103 SN02 sata 
-</code> 
- 
-<WRAP important> 
-**WARNING:**  Ensure that the disk with the Ubuntu operating system is not used. 
- 
-  * Also exclude any other disks that may contain data not to be destroyed. 
- 
-</WRAP> 
  
 ---- ----
  
-===== Delete Existing Partitions if required =====+[[ZFS:Pools:Create a ZFS Pool:RAID 0 - Striping|RAID 0 - Striping]]
  
-Delete all partitions and reset it:+[[ZFS:Pools:Create a ZFS Pool:RAID 1 - Mirroring|RAID 1 - Mirroring]]
  
-<code bash> +[[ZFS:Pools:Create a ZFS Pool:RAID 10 Striped Mirror|RAID 10 Striped Mirror]]
-sudo sgdisk - -zap-all /dev/sdb +
-</code>+
  
 +[[ZFS:Pools:Create a ZFS Pool:RAID Z1 - Like RAID 5|RAID Z1 - Like RAID 5]]
  
-Create a partition with 1GB of trailing free space:+[[ZFS:Pools:Create a ZFS Pool:RAID Z2 - Like RAID 6|RAID Z2 - Like RAID 6]]
  
-<code bash> +[[ZFS:Pools:Create a ZFS Pool:RAID Z3|RAID Z3]]
-sudo sgdisk -n1:0:-1G -t1:BF00 /dev/sdb +
-</code> +
- +
-<WRAP info> +
-**NOTE:**  Adjust these values as required. +
-</WRAP> +
- +
- +
-<WRAP info> +
-**NOTE:**  This will result in a /dev/sdb1 partition being created. +
-</WRAP>+
  
 ---- ----
  
-===== Creating a Pool =====+[[ZFS:Pools:Create ZFS Pool:Create a ZFS Pool using a File as a Device|Create a ZFS Pool using a File as a Device]]
  
-Different types of storage pools can be created: +[[ZFS:Pools:Create ZFS Pool:Create a ZFS Pool with an alternate Mount Point|Create ZFS Pool with an alternate Mount Point]]
- +
-  * A striped pool, also called RAID-0, in which the data is stored in “stripes” across all drives. +
-    * Striped pools are not fault tolerant! +
-    * Striped pools have twice the storage capacity of mirrored pools and have better performance than mirrored pools. +
- +
-  * A mirrored pool, also called RAID-1, in which complete copy of all data is stored separately on each drive. +
-    * Mirrored pools can survive the failure of one drive. +
- +
-To create a striped pool: +
- +
-<code bash> +
-sudo zpool create testpool /dev/sdb /dev/sdc +
-</code> +
- +
-To create mirrored pool: +
- +
-<code bash> +
-sudo zpool create testpool mirror /dev/sdb /dev/sdc +
-</code> +
- +
-<WRAP info> +
-**NOTE:**  Here, entire disks are being used for the pool. +
- +
-  * ZFS also supports creating pools from disk partitions, such as /dev/sdb1. +
-  * 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> +
- +
-<WRAP info> +
-**NOTE:**  The newly mounted pool will appear as any other part of the filesystem. +
- +
-  * **testpool** is the name of the pool. +
- +
-  * The newly created pool will be mounted at **/testpool**. +
-    * You can select different mount point using the **-m** option: <code bash> +
-sudo zpool create -m /mnt/testpool testpool mirror /dev/sdb /dev/sdc +
-</code> +
- +
-</WRAP> +
- +
-<WRAP info> +
-**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: +
- +
-<code bash> +
-sudo zpool create -f testpool /dev/sdb /dev/sdd +
-</code> +
- +
-</WRAP> +
- +
- +
-<WRAP info> +
-**NOTE:**  Advanced options can also be used when creating a pool. +
- +
-<code bash> +
-sudo zpool create -f -o ashift=12 -O compression=lz4 my_pool /dev/sdb1 +
-</code> +
- +
-  * **ashift**:  corresponds to 4k sector size. +
-  * **compression**: Enables LZ4 compression. +
-  * **my_pool**:  The name of my new zpool. +
-  * **/dev/sdb1**:  The disk partition to use for the pool. +
- +
-</WRAP>+
  
 +[[ZFS:Pools:Create a ZFS Pool:Dry Run|Dry Run]]
  
 ---- ----
  
-===== List Mounts ===== +[[ZFS:Pools:Create a ZFS Pool:Comprehensive Steps to Create a ZFS Pool|Comprehensive Steps to Create a ZFS Pool]]
- +
-Check the Mount is showing: +
- +
-<code bash> +
-df -h +
-</code> +
- +
----- +
- +
-===== 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 +
-</code> +
- +
----- +
- +
-===== Check Pool Status ===== +
- +
-<code bash> +
-sudo zpool status +
-</code> +
- +
  
zfs/pools/create_a_zfs_pool.1634081974.txt.gz · Last modified: 2021/10/12 23:39 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki