Slax author's Blog (RSS)
02
January2023
Persistent changes 10x faster in Slax
Slax is using DynFileFS for storing persistent changes if you boot from a FAT32 drive. DynFileFS is a fuse-based filesystem which I wrote 10 years ago as a quick hack, and to be honest, it was sometimes a bit slow, especially after storing several gigabytes of data.
If you noticed "changes.dat" file in Slax's /changes/ directory, this is the default storage for persistent changes, which are created by using DynFileFS.
I decided to review the code and as a result I rewrote the filesystem's internal logic completely. New DynFileFS version 3.0 is now available at github. It uses different file format on disk, so it is not backward compatible, but I believe it is worth it.
How does it work? Simply said, it provides a virtual file called "virtual.dat" after mounting it to some directory. This file can be of any specified size, like 30GB, but it does not need to pre-allocate this huge amount of disk space on mount. All changes made to this virtual file are stored in an indexed storage in a different file on disk, for example called changes.dat, and this file grows in time as your changes are made. As a result, it stores only the changes on disk, and not the free space between them.
The same effect could be achieved by using sparse file for storing changes, but unfortunately FAT32 does not support sparse files, and it is still the mostly used filesystem on USB devices.
The overhead of DynFileFS is around 2MB for each 1GB of virtual storage capacity, and each read/write operation requires only one additional seek+read in the storage file, so it is extremely fast.
I will use DynFileFS 3.0 in the next Slax release. Stay tuned. Have a nice day :)
User comments
1) it may have a setting (with 4GB as default) for maximum size each file to grow, rather than fixing 4GB
2) wishlist: these multiple files may be on various devices specified paths. This will help us in one single mountpoint of big size with many 2GB or 4GB on different underlying FAT32 partitions.
where this feature2 will be useful: I see this file system as very good solution for using it other than slax booting. It will be useful for accumulating free space of various NTFS/FAT file systems in single POSIX mount point
Thank you for the good job! Wold be great if DynFileFS works with multiple 4GB splited files, so would be possible to have a filesystem greater than 4GB in vfat usb. I don't know how to do it, it's just a idea.