DF-0867 / setup.sh
#!/bin/sh # DF-0867 setup (MUST run as root): create a HAMMER filesystem image, # newfs it, mount it, and leave a target file for the trigger to operate on. # Prints the mount point + target path on stdout for run.sh to consume. set -e IMG=/root/df0867_hammer.img MNT=/mnt/df0867 # Only vn0..vn3 exist as device nodes on this guest; pick a free one. VND="" for c in 0 1 2 3; do if vnconfig -l "vn$c" 2>/dev/null | grep -q "not in use"; then VND="vn$c"; break fi done [ -n "$VND" ] || { echo "SETUP_FAIL: no free vn device"; exit 4; } # Clean any prior run umount "$MNT" 2>/dev/null || true vnconfig -u "$VND" 2>/dev/null || true rm -f "$IMG" mkdir -p "$MNT" # 2 GiB sparse image (HAMMER1 wants >= ~50MB for freemap/undo; 2G is safe) truncate -s 2G "$IMG" # Attach a vnode disk vnconfig -c "$VND" "$IMG" # Create a HAMMER filesystem (single volume). -f allows the small image # (HAMMER normally wants >=10GB; sparse image keeps real usage tiny). newfs_hammer -f -L df0867 "/dev/$VND" # Mount read-write mount_hammer "/dev/$VND" "$MNT" # Target: a plain file on the freshly mounted HAMMER fs touch "$MNT/target" echo "SETUP_OK mnt=$MNT target=$MNT/target vnd=$VND" |