This document describes how to set up a development environment for OpenZFS using Docker on macOS with Apple Silicon processors.
- macOS with Apple Silicon (M1/M2/M3/M4)
- tested on M3 Max Macbook
- Docker Desktop for Mac installed and running
If you want to create the docker image outside of this repository then create a new directory for the ZFS development environment and save the Dockerfile to your new directory, in any event continue to next step.
From the docker directory;
- Build the Docker image:
docker build -t zfs-dev .- Run the container:
docker run -it -v $(pwd):/workspace zfs-dev /bin/bashThe -v $(pwd):/workspace flag creates a volume mount between your host machine's current directory and the container's
/workspace directory, allowing file sharing between host and container.
Currently, we can run the userland test suite using ztest. To run it:
cd /zfs
./ztest- Creates artificial workloads on ZFS
- Tests userland components without requiring kernel modules
- Creates in-memory test pools
- Exercises various ZFS operations
- Particularly effective at finding:
- Race conditions
- Edge cases
- Memory leaks
- Data corruption issues
- Uses randomized workloads, making each test run unique
To run the complete ZFS test suite, we'll need to:
-
Modify the Docker configuration to run with extended privileges:
- Need to run Docker with
--privilegedflag - Possibly need additional volume mounts for device access
- Need to run Docker with
-
Set up kernel module support:
- Load ZFS kernel module in container
- Configure module parameters
- Set up device mapper support
-
Configure test environment:
- Create physical test pools
- Set up proper permissions
- Configure test suite parameters
-
Run full test suite:
cd /zfs/tests ./runfiles/linux.run
-
VM-based testing:
- Using VirtualBox or VMware
- Full system access
- More realistic testing environment
- Easier kernel module handling
-
Host system testing:
- Direct installation on Linux partition
- Native performance
- Full system access
- More complex setup
The current setup allows for:
- Code reading and navigation
- Basic development work
- Userland testing via ztest
- Building and modifying OpenZFS code
Remember to:
- Work in the
/workspacedirectory for persistent changes - Commit changes to your fork of OpenZFS
- Follow the OpenZFS contribution guidelines
This project (not OpenZFS, this repository) is licensed under the MIT License - see the LICENSE file for details.