Open main menu

Wiki-Orange Pi β

Changes

Orange Pi CM4

1,537 bytes added, 14:22, 19 September 2023
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 1.6G 18M 1.6G 2Filesystem &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size &nbsp;&nbsp;&nbsp; Used Avail Use% /runMounted on
/dev/mmcblk0p2 29G 6tmpfs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.6G &nbsp;&nbsp;&nbsp; 18M 1.0G 22G 226G 2% /run <br>
tmpfs 7.7G 46M 7/dev/mmcblk0p2 &nbsp;&nbsp;&nbsp; 29G &nbsp;&nbsp;&nbsp; 6.7G 10G 22G 22% /dev/shm<br>
tmpfs 5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7.0M 47G &nbsp;&nbsp;&nbsp; 46M 7.0K 5.0M 7G 1% /rundev/lockshm <br>
tmpfs 7 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.7G 944K 70M &nbsp;&nbsp;&nbsp; 4.7G 0K 5.0M 1% /tmprun/lock <br>
/dev/mmcblk0p1 1022M 115M 908M 12tmpfs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7.7G &nbsp;&nbsp;&nbsp; 944K 7.7G 1% /boottmp <br>
/dev/zram1 188M 4.5M 169M 3mmcblk0p1 &nbsp;&nbsp;&nbsp; 1022M &nbsp;&nbsp;&nbsp; 115M 908M 12% /var/logboot <br>
tmpfs 1.6G 80K 1/dev/zram1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 188M &nbsp;&nbsp;&nbsp; 4.6G 15M 169M 3% /run/uservar/1000log <br>
'''pool1 489G 9tmpfs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.3M 489G 6G &nbsp;&nbsp;&nbsp; 80K 1.6G 1% /pool1'''run/user/1000 <br>
'''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% <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' -&gt; '/pool1/test.mp4'
|}
</ol>
<span id="test-the-data-deduplication-function-of-zfs"></span>
<span id="test-the-data-deduplication-function-of-zfs"></span>
=== Test the data deduplication function of ZFS ===