Slax author's Blog (RSS)
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 :)