#!/bin/sh
# DF-3215 setup (ROOT, in-guest): create a small-undo HAMMER1 filesystem.
# newfs_hammer allows UNDO/REDO FIFO sizes below the 512MB default with -f
# (minimum = one 8MB big-block, sbin/hammer/ondisk.c:format_undomap).
# 8MB is the smallest UNDO/REDO FIFO newfs_hammer can create.
#
# usage: setup_v2.sh
set -e
VNDIR=/var/tmp/df3215
IMG=$VNDIR/h1.img
MP=/mnt/h1

mkdir -p $VNDIR $MP
rm -f $IMG
truncate -s 12G $IMG
vnconfig -u vn0 2>/dev/null || true
vnconfig -c vn0 $IMG
# -f: allow <10GB fs;  -u 8m: 8MB UNDO/REDO FIFO (1 big-block)
newfs_hammer -f -L DF3215 -u 8m /dev/vn0
mount -t hammer -o nohistory /dev/vn0 $MP
mkdir -p $MP/scratch
chmod 1777 $MP/scratch
echo "== setup done =="
mount | grep "/mnt/h1"
