blob: 9fee2227d9f5bfb8dc17b20ed978498dfb50133a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/bash
set -o nounset
set -o errexit
set -o errtrace
set -o pipefail
while getopts "hd:m:f:" arg; do
case $arg in
h)
usage
exit 0
;;
d)
DEV=$OPTARG
;;
m)
MNT=$OPTARG
;;
f)
FS=$OPTARG
;;
esac
done
if [[ -z ${DEV-} ]]; then
echo "Required parameter -d missing: device to test"
exit 1
fi
if [[ -z ${MNT-} ]]; then
echo "Required parameter -m missing: mount point"
exit 1
fi
if [[ -z ${FS-} ]]; then
echo "Required parameter -f missing: filesystem type"
exit 1
fi
umount $DEV >/dev/null 2>&1 || true
umount $MNT >/dev/null 2>&1 || true
blkdiscard $DEV >/dev/null 2>&1 || true
case $FS in
bcachefs)
bcachefs format -f \
--errors=panic \
$DEV
;;
bcachefs-no-checksum)
bcachefs format -f \
--errors=panic \
--data_checksum=none \
$DEV
FS=bcachefs
;;
ext4)
mkfs.ext4 -F $DEV
;;
ext4-no-journal)
mkfs.ext4 -F -O ^has_journal $DEV
FS=ext4
;;
xfs)
mkfs.xfs -f $DEV
;;
btrfs)
mkfs.btrfs -f $DEV
;;
esac
mount -t $FS $DEV $MNT
|