Changes

Jump to: navigation, search

Orange Pi 5 Plus

978 bytes added, 17:24, 12 June 2023
关机和重启开发板的方法
<span id="the-method-of-shutting-down-and-restarting-the-development-board"></span>
== 关机和重启开发板的方法 How to use the ZFS file system ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''最新版本的Ubuntu20The latest version of Ubuntu20.04、Ubuntu2204, Ubuntu22.04, Debian11 and Debian12 desktop version systems have pre-installed zfs, you can use it directly.04、Debian11和Debian12桌面版系统中已经预装了zfs,直接使用即可。'''
'''在Ubuntu20The pre-installed zfs version in Ubuntu20.04、Ubuntu2204 and Ubuntu22.04桌面版系统中预装的zfs版本是204 desktop systems is 2.1.6。6.'''
'''在Debian11和Debian12桌面版系统中预装的zfs版本是2The pre-installed zfs version in Debian11 and Debian12 desktop systems is 2.1.11。11.'''
'''系统启动后,首先请确认下zfs的内核模块有没有被加载,如果使用lsmod命令可以看到zfs相关的内容,就说明系统已经预装了zfs。After the system starts, please first confirm whether the zfs kernel module has been loaded. If you can see zfs-related content using the lsmod command, it means that the system has pre-installed zfs.'''
orangepi@orangepi:~$ '''lsmod | grep "zfs"'''</big>
|}
=== 安装ZFS的方法 How to install ZFS ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''安装zfs前,请先确保使用的linux镜像为最新版本。另外,如果系统中已经安装了zfs,就无需重复安装了。Before installing zfs, please ensure that the Linux image used is the latest version. In addition, if zfs is already installed in the system, there is no need to install it again.'''</big>
|}
安装zfs前首先需要安装内核头文件,安装内核头文件的方法请参考[[Orange Pi 5 Plus#安装内核头文件的方法|安装内核头文件的方法]]小节的说明。Before installing zfs, you need to install the kernel header file first. '''For the method of installing the kernel header file''', please refer to the instructions in the section on the method of installing the kernel header file.
在Ubuntu20In Ubuntu20.04、Ubuntu2204, Ubuntu22.04和Debian11系统中,zfs是无法通过apt直接安装的,这是因为默认的apt源中zfs版本低于204 and Debian11 systems, zfs cannot be installed directly through apt, because the default apt source zfs version is lower than 2.1.6,存在和rk 6, and there is a problem of incompatibility with rk linux5.10内核不兼容的问题,这个问题在zfs的210 kernel. This problem is fixed in zfs version 2.1.6及以后的版本中得到了修复。6 and later.
为了解决这个问题,我们提供了能正常安装的zfs的deb包,可以从开发板的To solve this problem, we provide a zfs deb package that can be installed normally, which can be downloaded from the '''官方工具official tool'''中下载到。打开of the development board. Open the '''官方工具official tool''',然后进入, and then enter the '''Ubuntu和Debian系统使用的zfs相关的deb包zfs-related deb package folders used by Ubuntu and Debian systems'''文件夹后,可以看到Ubuntu20.04、Ubuntu22You can see three types of deb packages: Ubuntu20.04, Ubuntu22.04 and Debian11. Please download the required version.04和Debian11三种类型的deb包,请下载需要的版本。
<p>[[File:5plus-3.png]]</p>
下载完对应版本的zfs deb包后,请将它们上传到开发板的Linux系统中。上传方法请参考After downloading the zfs deb packages of the corresponding version, please upload them to the Linux system of the development board. For the upload method, please refer to the description in [[Orange Pi 5 Plus#上传文件到开发板Linux系统中的方法The method of uploading files to the Linux system of the development board|上传文件到开发板Linux系统中的方法'''the section of the method of uploading files to the Linux system of the development board''']]小节的说明。.
上传完成后,再在开发板linux系统的命令行中使用After the upload is complete, use the '''cd'''命令进入deb包的目录,然后使用下面的命令就可以安装zfs的deb包。command in the command line of the development board linux system to enter the deb package directory, and then use the following command to install the zfs deb package.
{| class="wikitable" style="width:800px;"
|-
|}
安装完成后,使用下面的命令可以看到zfs相关的内核模块:After the installation is complete, use the following command to see the zfs-related kernel modules:
{| class="wikitable" style="width:800px;"
|}
然后重启下linux系统就能看到zfs内核模块会自动加载了:Then restart the Linux system to see that the zfs kernel module will be automatically loaded:
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|}
在Debian12中,zfs的默认版本为2In Debian12, the default version of zfs is 2.1.11,所以我们可以通过下面的命令直接安装zfs,再次提醒下,安装前需要确保系统已安装内核头文件的deb包。11, so we can install zfs directly through the following command. Again, please make sure that the system has installed the deb package of the kernel header file before installation.
{| class="wikitable" style="width:800px;"
|}
=== 创建ZFS池的方法 Methods of creating ZFS pools ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''ZFS是基于存储池的,我们可以将多个物理存储设备添加到池中,然后从这个池中分配存储空间。ZFS is based on storage pools, we can add multiple physical storage devices to the pool, and then allocate storage space from this pool.'''
'''下面的内容是基于开发板接了一个NVMe SSD和一个U盘来演示的。The following content is demonstrated based on the development board connected to an NVMe SSD and a USB flash drive.'''</big>
|}
1) 首先我们可以通过First, we can use the '''lsblk'''命令查看下开发板所有的存储设备,当前开发板接了一个NVMe SSD以及一个U盘,输出如下所示:command to view all storage devices on the development board. The current development board is connected to an NVMe SSD and a U disk. The output is as follows:
<p>[[File:5plus-4.png]]</p>
2) 然后输入下面的命令可以创建一个ZFS池,包含NVMe SSD和U盘两个存储设备Then enter the following command to create a ZFS pool, including two storage devices, NVMe SSD and U disk
{| class="wikitable" style="width:800px;"
|}
3) 然后使用Then use the '''zpool list'''命令可以看到系统已经创建了一个名为pool1的ZFS池,并且ZFS池pool1的大小是NVME SSD的大小加上U盘的大小command to see that the system has created a ZFS pool named '''pool1''', and the size of the ZFS pool pool1 is the size of the NVME SSD plus the size of the U disk
<p>[[File:5plus-5.png]]</p>
4) 然后执行Then execute '''df -h'''可以看到to see that '''pool1'''被挂载到了is mounted to the '''/pool1'''目录directory
{| class="wikitable" style="width:800px;"
'''pool1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 489G &nbsp;&nbsp;&nbsp; 9.3M 489G 1% /pool1''' <br>
|}
5) 使用下面的命令可以看到pool1的文件系统类型为zfsUse the following command to see that the file system type of pool1 is zfs
{| class="wikitable" style="width:800px;"
pool1 on /pool1 type '''zfs''' (rw,xattr,noacl)
|}
6) 然后我们可以测试下拷贝一个文件到ZFS池中Then we can test copying a file to the ZFS pool
{| class="wikitable" style="width:800px;"
|}
=== 测试ZFS的数据去重功能 Test the data deduplication function of ZFS ===1) ZFS的数据去重功能默认是关闭的,我们需要执行下面的命令打开The data deduplication function of ZFS is disabled by default, we need to execute the following command to enable it
{| class="wikitable" style="width:800px;"
orangepi@orangepi:~$ '''sudo zfs set dedup=on pool1'''
|}
2) 然后做一个简单的测试,首先进入pool1中,再执行下面的命令生成1个1G大小的随机文件Then do a simple test, first enter pool1, and then execute the following command to generate a random file with a size of 1G
{| class="wikitable" style="width:800px;"
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.04367 s, 213 MB/s <br>
|}
3) 然后使用下面的命令将1G大小的随机文件拷贝1000份Then use the following command to copy 1000 random files of size 1G
{| class="wikitable" style="width:800px;"
root@orangepi:/pool1$ '''for ((i=0; i<1000; i++)); do sudo cp test.1g $i.test.1g; done'''
|}
4) 然后用Then use '''du -lh'''可以看到目前池中总共有1002G的数据,但实际上ZFS池的大小只有to see that there are currently 1002G of data in the pool, but in fact the size of the ZFS pool is only '''504GB'''(SSD(the total capacity of SSD+U盘的总容量),是装不下那么大的数据的U disk), which cannot hold such a large amount of data
{| class="wikitable" style="width:800px;"
1002G
|}
5) 然后用Then use the '''zpool list'''命令可以看到实际只占用了1command to see that only 1.01G is actually occupied, because these 1001 files are all duplicates, indicating that the data deduplication function is effective.01G,因为这1001个文件都是重复的,说明数据去重功能有效。
<p>[[File:5plus-6.png]]</p>
=== 测试ZFS的数据压缩功能 Test the data compression function of ZFS ===
1) 因为存储的数据不同,压缩节省的磁盘空间也会有所不同,所以我们选择压缩比较大的纯文本文件来进行压缩测试,执行下面的命令将Because the stored data is different, the disk space saved by compression will also be different, so we choose to compress relatively large plain text files for compression testing, and execute the following commands to pack the '''/var/log/'''and '''/etc/'''目录打包成tar包directories into a tarball
{| class="wikitable" style="width:800px;"
root@orangepi:/pool1$ '''sudo tar -cf text.tar /var/log/ /etc/'''
|}
2) 然后通过Then the file size that can be seen through the '''ls -lh'''命令可以看到的文件大小以及在ZFS池中占用的空间都是command and the space occupied in the ZFS pool are both '''27M'''
<p>[[File:5plus-7.png]]</p>
3) 然后我们在ZFS池pool1中启用压缩功能Then we enable compression in the ZFS pool pool1
{| class="wikitable" style="width:800px;"
root@orangepi:/pool1$ '''sudo zfs set compression=lz4 pool1'''
|}
4) 然后再次执行下面的命令将Then execute the following command again to package the '''/var/log/'''and '''/etc/'''目录打包成tar包directories into a tar package
{| class="wikitable" style="width:800px;"
root@orangepi:/pool1$ '''sudo tar -cf text.tar /var/log/ /etc/'''
|}
5) 这时可以看到At this time, you can see that the size of the '''text.tar'''文件大小还是27M,但是在ZFS池中只占用9file is still 27M, but it only occupies 9.47M的空间,说明文件被压缩了47M in the ZFS pool, indicating that the file is compressed
<p>[[File:5plus-8.png]]</p>
 
== The method of shutting down and restarting the development board ==

Navigation menu