⬢ DragonFlyBSD Kernel Audit
DF-2585 / build_cluster.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2585 — build a local 2-node hammer2 cluster (two identical MASTER copies
# share the same pfs_clid, so mounting both devices as one cluster gives
# iroot->cluster.nchains == 2 => xops run at clindex 1, which is the only
# way hammer2_xop_inode_flush's volume-dedup loop (flush.c:1377-1384) ever
# executes).
set -e
umount /mnt/c2 2>/dev/null || true
vnconfig -u vn0 2>/dev/null || true
vnconfig -u vn1 2>/dev/null || true
mkdir -p /mnt/c2
rm -f /root/c2a.img /root/c2b.img
truncate -s 1073741824 /root/c2a.img
vnconfig -c -S -T vn0 /root/c2a.img
newfs_hammer2 -L CLUS /dev/vn0 >/dev/null 2>&1
vnconfig -u vn0
cp /root/c2a.img /root/c2b.img
vnconfig -c -S -T vn0 /root/c2a.img
vnconfig -c -S -T vn1 /root/c2b.img
mount -t hammer2 /dev/vn0@CLUS:/dev/vn1@CLUS /mnt/c2
echo CLUSTER-MOUNT-OK
df /mnt/c2
mount | grep c2
echo hello > /mnt/c2/probe
sync
cat /mnt/c2/probe
ls -la /mnt/c2