82 lines
1.7 KiB
Markdown
82 lines
1.7 KiB
Markdown
## 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
|
|
```sh
|
|
gcc fs-watcher.c json-writer.c -o fa2json
|
|
```
|
|
### Create image file
|
|
```sh
|
|
mktemp /tmp/fa2json-test-XXXXXX.img
|
|
```
|
|
|
|
```text
|
|
/tmp/fa2json-test-UrwpOb.img
|
|
```
|
|
|
|
```sh
|
|
truncate -s 10M /tmp/fa2json-test-UrwpOb.img
|
|
```
|
|
|
|
```sh
|
|
mkfs.ext4 /tmp/fa2json-test-UrwpOb.img
|
|
```
|
|
|
|
```text
|
|
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
|
|
|
|
```sh
|
|
mktemp -d /tmp/fa2json-mnt-XXXXXX
|
|
```
|
|
|
|
```text
|
|
/tmp/fa2json-mnt-ts2Dik
|
|
```
|
|
|
|
### Mount loop device
|
|
```sh
|
|
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`?
|
|
> ```sh
|
|
> fa2json /tmp/fa2json-mnt-ts2Dik
|
|
> ```
|
|
|
|
### Let current user own file system
|
|
```sh
|
|
sudo chown $(id -u) /tmp/fa2json-mnt-ts2Dik/
|
|
```
|
|
|
|
#### `fa2json` output
|
|
```json
|
|
{"ts": [1772658052, 704412412, 386988, 865842867], "name": "/tmp/fa2json-mnt-ts2Dik/.", "mask": 1073741828}
|
|
```
|
|
|
|
### Touch marker
|
|
```sh
|
|
touch /tmp/fa2json-mnt-ts2Dik/MARKER
|
|
```
|
|
|
|
#### `fa2json` output
|
|
```json
|
|
{"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}
|
|
``` |