Files
fa2json/test/Manual experiment.md

1.7 KiB

Manual experiment

Note

This manual experiment shows how we can do the testing (teardown not included). Note that we don't need the losetup-stuff, we know where everything is.

Compile

gcc fs-watcher.c json-writer.c -o fa2json

Create image file

mktemp /tmp/fa2json-test-XXXXXX.img
/tmp/fa2json-test-UrwpOb.img
truncate -s 10M /tmp/fa2json-test-UrwpOb.img
mkfs.ext4 /tmp/fa2json-test-UrwpOb.img
mke2fs 1.47.3 (8-Jul-2025)
Discarding device blocks: done
Creating filesystem with 10240 1k blocks and 2560 inodes
Filesystem UUID: 035c508e-dec0-4a21-a4d1-1efb6fa72415
Superblock backups stored on blocks:
        8193

Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

Create mount point

mktemp -d /tmp/fa2json-mnt-XXXXXX
/tmp/fa2json-mnt-ts2Dik

Mount loop device

sudo mount /tmp/fa2json-test-UrwpOb.img /tmp/fa2json-mnt-ts2Dik/

Note

In a different terminal I now ran - but we could do this after chown or possibly chown + sync?

fa2json /tmp/fa2json-mnt-ts2Dik

Let current user own file system

sudo chown $(id -u) /tmp/fa2json-mnt-ts2Dik/

fa2json output

{"ts": [1772658052, 704412412, 386988, 865842867], "name": "/tmp/fa2json-mnt-ts2Dik/.", "mask": 1073741828}

Touch marker

touch /tmp/fa2json-mnt-ts2Dik/MARKER

fa2json output

{"ts": [1772658064, 151070715, 387000, 312501190], "name": "/tmp/fa2json-mnt-ts2Dik/MARKER", "mask": 256}
{"ts": [1772658064, 151099105, 387000, 312529600], "name": "/tmp/fa2json-mnt-ts2Dik/MARKER", "mask": 12}