How to run ZFS tests on VM environment

1. Setup VM with:

  • CPU - 4

  • Memory - 8GB

  • Hard disk - 100GB (for software installation) SATA

  • Three additional hard drives - 8GB (for zfs test) SATA or NVME

  • Have to use DEBUG build, where we have debug macro

names of other pools

Do not create pools with names that can be used in the tests, i.e. testpool*. Otherwise tests can work incorrectly.

Setup process is described in this instruction.

Note : If you already created dilos_BASE BE according the instruction, and there is no any new tested stable version, just execute the following command:

beadm activate dilos_BASE

In other case if you have already the dilos_ISO_orig BE - make the command:

beadm activate dilos_ISO_orig

Then reboot and start the instruction from the section Step 6. Prepare VM for Tests Running:

reboot

If you have no one of these 2 BEs then start the instruction from the beginning.

Note : Create ztest user if you forgot to do it according the instruction:

sudo useradd -m -d /var/ztest -g staff -s /bin/bash ztest

sudo passwd ztest

echo "ztest ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ztest

2. Install packages for zfs tests:

apt update reboot apt install system-test-zfstest testrunner system-file-system-zfs-tests python3 screen

3. Update /etc/sudoers:

sudo -E /usr/bin/sed -i.bak '/secure_path/a\Defaults exempt_group+=staff' /etc/sudoers sudo -E /usr/bin/sed -i.bak 's/ requiretty/ !requiretty/' /etc/sudoers

4. Create auxiliary scripts required for cli_user tests:

Create a file /usr/share/zfs/zpool.d/upath with this content or execute the following command:

su - mkdir /usr/share/zfs/zpool.d cat > /usr/share/zfs/zpool.d/upath <<EOT #!/bin/sh if [ "\$1" = "-h" ] ; then         echo "Show the underlying path for a device."         exit fi  # shellcheck disable=SC2154 echo upath="\$VDEV_UPATH" EOT sed -i '/./!d' /usr/share/zfs/zpool.d/upath

Then create a file /usr/share/zfs/zpool.d/iostat with the following content or execute the following commands:

After that do the following steps:

5. Login by user ztest and run tests:

You can run tests with the special test script. The script can be created with any text editor or by executing the following command:

After running of this script you will find the log in the /var/tmp/zfstest.<ISO TIME>.txt file. It will contain information in the format that is used in Test Results.

Before running of this script you have to get IDs of tree 8-GB disks from this VM. You can do it with the diskinfo command and run the test script with these IDs in parameters (you can find IDs in the DISK column of the diskinfo output), for example:

Wait about 5h-6h or more for full tests and found full logs at:

/var/tmp/test_results/<ISO TIME>

If you use the SCREEN utility, your command will look like this:

ztest@zone:~# screen ./z.sh <disk1> <disk2> <disk3>

Then you can disconnect in any time by pressing Ctrl-A d and connect back in the new SSH session by the command:

ztest@zone:~# screen -r


Running in stability mode