8,367
edits
Changes
→Methods of creating ZFS pools
=== Methods of creating ZFS pools ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''ZFS is based on storage pools, we can add multiple physical storage devices to the pool, and then allocate storage space from this pool.'''
'''The following content is demonstrated based on the development board connected to an NVMe SSD and a USB flash drive.'''</big>|}
# First, we can use the '''lsblk''' 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:
::[[File:cm4-img385.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then enter the following command to create a ZFS pool, including two storage devices, NVMe SSD and U disk</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo zpool create -f pool1 /dev/nvme0n1 /dev/sda'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then use the '''zpool list''' 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</li></ol>
[[File:cm4-img386.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then execute '''df -h''' to see that '''pool1''' is mounted to the '''/pool1''' directory</li></ol>{| class="wikitable" style="width:800px;" |-|orangepi@orangepi:~$ '''df -h''' Filesystem Size Used Avail Use% Mounted on<br>
tmpfs 5 7.0M 47G 46M 7.0K 5.0M 7G 1% /rundev/lockshm <br>
tmpfs 7 5.7G 944K 70M 4.7G 0K 5.0M 1% /tmprun/lock <br>
/dev/zram1 188M 4.5M 169M 3mmcblk0p1 1022M 115M 908M 12% /var/logboot <br>
'''pool1 489G 9.3M 489G 1% <span style="color:#FF0000">/pool1</span>''' <br>
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Use the following command to see that the file system type of pool1 is zfs</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''mount | grep pool1'''
pool1 on /pool1 type '''zfs''' (rw,xattr,noacl)
|}</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then we can test copying a file to the ZFS pool</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo cp -v /usr/local/test.mp4 /pool1/'''
'/usr/local/test.mp4' -> '/pool1/test.mp4'
|}
</ol>
<span id="test-the-data-deduplication-function-of-zfs"></span>
=== Test the data deduplication function of ZFS ===