DragonFlyBSD Kernel Audit
DF-2617 / mkbase2617.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2617: build the base image (PFS "testvol" with 33 entries -> INDIRECT blocks
# in the root directory inode's blockset).  Stock, never-corrupted.
set -e
vnconfig -u vn0 2>/dev/null || true
mkdir -p /root/poc/df2617
cd /root/poc/df2617
rm -f base2617.img
truncate -s 64M base2617.img
newfs_hammer2 -L testvol base2617.img >/dev/null
vnconfig -c vn0 /root/poc/df2617/base2617.img
mkdir -p /mnt/h2
mount -t hammer2 /dev/vn0@testvol /mnt/h2
printf "DF2617BASE-f1" > /mnt/h2/f1
i=0
while [ $i -lt 32 ]; do
	printf "DF2617BASE-w%02d" $i > /mnt/h2/w$i
	i=$((i+1))
done
ls /mnt/h2 | wc -l
sync
umount /mnt/h2
vnconfig -u vn0
echo BASE2617_OK