4 # cross check mkfs detection of foreign filesystems
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22 # get standard environment, filters and checks
26 # real QA test starts here
33 echo "Silence is golden."
34 for fs in `echo /sbin/mkfs.* | sed -e 's/.sbin.mkfs.//g'`
36 preop="" # for special input needs
37 preargs="" # for any special pre-device options
38 postargs="" # for any special post-device options
40 # minix, msdos and vfat mkfs fails for large devices, restrict to 2000 blocks
41 [ $fs = minix ] && postargs=2000
42 [ $fs = msdos ] && postargs=2000
43 [ $fs = vfat ] && postargs=2000
44 # these folks prompt before writing
45 [ $fs = jfs ] && preop="echo Y |"
46 [ $fs = gfs ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
47 [ $fs = gfs2 ] && preop="echo y |"
48 [ $fs = reiserfs ] && preop="echo y |" && preargs="-f"
49 # cramfs mkfs requires a directory argument
50 [ $fs = cramfs ] && preargs=/proc/fs/xfs
51 [ $fs = ext2 ] && preargs="-F"
52 [ $fs = ext3 ] && preargs="-F"
53 [ $fs = ext4 ] && preargs="-F"
54 [ $fs = ext4dev ] && preargs="-F"
56 # overwite the first few Kb - should blow away superblocks
57 src/devzero -n 20 $SCRATCH_DEV >/dev/null
59 # create a filesystem of this type
60 echo "=== Creating $fs filesystem..." >>$seq.full
61 echo " ( $preop mkfs -t $fs $preargs $SCRATCH_DEV $postargs )" >>$seq.full
62 eval $preop mkfs -t $fs $preargs $SCRATCH_DEV $postargs >>$seq.full 2>&1
64 # next, ensure we don't overwrite it
65 echo "=== Attempting XFS overwrite of $fs..." >>$seq.full
66 /sbin/mkfs.xfs $SCRATCH_DEV >>$seq.full 2>&1
68 [ $? -eq 0 ] && echo "Failed - overwrote fs type ${fs}!"