The goal of SPFS is to help people understand how to develop a kernel-based filesystem for Linux. It will be used as a teaching aid in a future open-source book on Linux filesystems and as the basis for an Udemy course on Linux filesystem development.
Here are the main characteristics of SPFS:
- Multi-level directories (directories within directories)
- Fixed block size (2048 bytes).
- Maximum filename length up to 28 characters.
- 760 blocks within the whole filesystem.
- A maximum file size of approximately 505 KB.
- A
mkfscommand to create the filesystem and afillfscommand to create more files than the basicmkfsdoes. This allows development of "read" operations before having to deal with operations that require creating strucutres on disk. - File undelete using the SPFS
fsdbcommand. - File creation, deletion, rename, symlinks, ...
Most of these limitations are in place to keep the on-disk structures very simple which result in the code to access them being much easier to understand. The goal here is for teaching only.
The filesystem will be updated once a year for new versions of Ubuntu (April releases) and bug fixes will only be applied to the current release.
Here is the disk layout. It's very restrictive. The superblock uses all of block 0 (2048 bytes) so the arrays for free inodes (s_inode) and data blocks (s_block) are fixed. This is what gives SPFS its fixed limitations.
To make SPFS more flexible, it would make the on-disk structures more complicated and since it's just for teaching purposes, simple wins.
A top-level Makefile has been added to simplify building of the user-space tools and the per-Ubuntu-version kernel modules.
makeormake common— build the command-line tools and tests intocommon/bin.make modules-22.10/make modules-23.04/make modules-24.04— build kernel module usingubuntu/<version>/kern/Makefile.make modules KVER=22.10— build the kernel module for the specifiedKVER.make modules-all— build all supported Ubuntu kernel module versions.make install-modules-22.10— runmodules_installfor that version (may require root).make clean— removecommon/binand runcleanin eachubuntu/*/kerndirectory.
Notes:
- Kernel module builds use the per-version kernel Makefile under
ubuntu/<version>/kernand require appropriate kernel headers for the host kernel. - Building kernel modules usually requires root privileges for installation; building (
make modules-<ver>) does not require root. - A new template
ubuntu/24.04-externalis available as an example that prefers an external kernel source. Seeubuntu/24.04-external/README.mdfor usage and a helper script to create alinux-srcsymlink.
Examples:
make
make modules-22.10
make modules KVER=24.04