Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to run ZFS on Linux

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to run ZFS on Linux. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Introduction to ZFS: ZFS is a 128bit file system with a total capacity of 1.84x1019 times that of the existing 64bit file system. It supports a single storage volume that reaches 16EiB (264byte, that is, 16x1024x1024TB).

An zpool storage pool can have 264 volumes with the largest total capacity of 256ZiB (278byte), and the entire system can have 2 ^ 64 storage pools.

It can be said that it is almost impossible for ZFS to have insufficient storage space for quite a long time in the future.

System information is copied after cat / etc/os-release login

NAME= "Ubuntu" VERSION= "18.04.2 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME= "Ubuntu 18.04.2 LTS" VERSION_ID= "18.04" disk Information in this article, three 1T ssd solid state disks are used for operation. The disk information is as follows:

Copy after login

Disk / dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk / dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk / dev/sdd: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors description ⚠️: this article focuses on the deployment and basic use of ZFS. For related concepts of ZFS, please see the reference document at the end of this article.

Install the ZFS service apt install zfsutils-linux-y apt install nfs-kernel-server to create a pool pool in ZFS, the pool pool is equivalent to RAID. The creation and use of pool pools is very simple and flexible, and ZFS provides a lot of parameters for us to choose from.

Create pool pools for different usage scenarios (1) ZFS to implement RAID0, just create a normal pool: sudo zpool create your-pool / dev/sdb / dev/sdc / dev/sdd

(2) mirror keyword is used in ZFS to implement RAID1 function: sudo zpool create your-pool mirror / dev/sdb / dev/sdc

(3) ZFS implements the RAID5 function as RAIDZ1:sudo zpool create your-pool raidz1 / dev/sdb / dev/sdc / dev/sdd

(4) ZFS implements the RAID6 function as RAIDZ2:sudo zpool create your-pool raidz2 / dev/sdb / dev/sdc / dev/sdd / dev/sde

(5) ZFS implements the RAID6 function as double mirror keywords: sudo zpool create your-pool mirror / dev/sdc / dev/sdd mirror / dev/sde / dev/sdf

Description ⚠️:

(1) this article focuses on the deployment and basic use of ZFS. For more information on the concepts and knowledge points related to RAID, please see the reference document link at the end of this article.

(2) with RAID1, the disk utilization is only 50%.

(3) at least 3 disks are required to use RAID5

(4) RAID6 is almost identical to RAID5, but it needs at least four disks.

(5) RAID10 needs at least four disks, but can only use half of the space, that is, 50% disk utilization

The main steps for creating a pool of RAIDZ1 class in practice are as follows:

(1) check the bare disk ID number: ll / dev/disk/by-id/, details are as follows:

Copy after login

Wwn-0x5002498e20d23d09->.. /.. / sdb wwn-0x5002498e29d76d78->.. /.. / sdc wwn-0x5002498e27d45d91->.. /.. / sdd (2) create a pool pool for the RAIDZ1 class

Sudo zpool create-f data_ssd raidz wwn-0x5002498e20d23d09 wwn-0x5002498e29d76d78 wwn-0x5002498e27d45d91 explains ⚠️: we can see that the data_pool pool has been created and mounted through the df-h command. The key information to be intercepted is as follows:

Data_ssd 1.8T 128K 1.8T 1% / data_ssd has a few information to pay attention to:

The number of the original bare disk is 3, the total size is 3T, and the available space of the disk is about 2T. This is because we are using RAIDZ1 (equivalent to RAID5)

The mount path / data_ssd does not need to be created in advance

(3) View the status of pool pool

Sudo zpool status, details are as follows:

Pool: data_ssd state: ONLINE scan: none requestedconfig:NAME STATE READ WRITE CKSUM data_ssd ONLINE 00 raidz1-0 ONLINE 00 wwn-0x5002498e20d23d09 ONLINE 00 wwn-0x5002498e29d76d78 ONLINE 00 wwn-0x5002498e27d45d91 ONLINE 0 0errors: No known data errors (4) enable pool pool compression

Zfs set compression=on data_ssd (5) enable pool pool sharing

When zfs set sharenfs=on data_ssd enables sharing, the ZFS file system can be shared to remote hosts like NFS and SMB.

(6) View the properties of the storage pool

Sudo zfs get all data_ssd, simply list a few lines for reference:

NAME PROPERTY VALUE SOURCEdata_ssd type filesystem-data_ssd creation Thu Aug 15 7:07 2019-data_ssd used 21.5G-data_ssd available 1.73T-data_ssd referenced 30.6K -data_ssd compre***atio 1.00x-data_ssd mounted yes-data_ssd quota none defaultdata_ssd reservation none defaultdata_ssd recordsize 128K defaultdata_ssd mountpoint / data_ssd defaultdata_ssd sharenfs on localdata_ssd checksum on defaultdata_ssd compression on local description ⚠️: we can see that both compre***atio and sharenfs are available ~

(7) create a ZFS file system

Zfs create data_ssd/test description ⚠️: Mount path / data_ssd/test does not need to be created in advance

(8) View ZFS file system information

Zfs get all data_ssd/test (9) turns off ZFS file system compression

Zfs set compression=off data_ssd/test (10) View ZFS pool and file system space usage information

Zfs list` or `zfs list data_ssd/test (11) Delete the ZFS file system

Zfs destroy data_ssd/test (12) Delete ZFS Pool

Zpool destroy data_ssd extends to view the SN code of a disk on the system, such as sdc: hdparm-I / dev/sdc

Test to turn off / enable ZSF compression, disk read and write speed:

What are the versions of time dd if=/dev/zero bs=1024000 count=100000 of=100GB.fileLinux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.

The above is how to run ZFS on Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report