]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/fdisk/align-512-4K-md
tests: split stdout and stderr
[thirdparty/util-linux.git] / tests / ts / fdisk / align-512-4K-md
1 #!/bin/bash
2
3 #
4 # This file is part of util-linux.
5 #
6 # This file is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This file is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16
17
18 #
19 # Test alignment for 512/512 disk *with* topology -- aligned to optimal
20 # I/O size (32KiB)
21 #
22
23 TS_TOPDIR="${0%/*}/../.."
24 TS_DESC="align 512/4K +MD"
25
26 . $TS_TOPDIR/functions.sh
27 ts_init "$*"
28
29 ts_check_test_command "$TS_CMD_FDISK"
30
31 ts_skip_nonroot
32 ts_check_prog "mdadm"
33
34 # set global variable TS_DEVICE
35 ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
36 DEVNAME=$(basename $TS_DEVICE)
37
38 ts_log "Create partitions"
39 $TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>> $TS_ERRLOG <<EOF
40 n
41 p
42 1
43
44 +20M
45 n
46 p
47 2
48
49
50 p
51 w
52 q
53 EOF
54
55 udevadm settle
56 ts_log "Alignment offsets:"
57 cat /sys/block/${DEVNAME}/${DEVNAME}{1,2}/alignment_offset >> $TS_OUTPUT 2>> $TS_ERRLOG
58
59 ts_lock "md"
60
61 MD_DEVNAME=md8
62 MD_DEVICE=/dev/${MD_DEVNAME}
63
64 mdadm -q -S ${MD_DEVICE} &> /dev/null
65 udevadm settle
66
67 mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 \
68 --level=0 --raid-devices=2 ${TS_DEVICE}1 ${TS_DEVICE}2 >> $TS_OUTPUT 2>> $TS_ERRLOG
69 udevadm settle
70
71 ts_log "Create partitions (MD)"
72 $TS_CMD_FDISK ${MD_DEVICE} >> $TS_OUTPUT 2>> $TS_ERRLOG <<EOF
73 n
74 p
75 1
76
77 +10M
78 n
79 p
80 2
81
82 +10M
83 p
84 w
85 q
86 EOF
87
88 udevadm settle
89 ts_log "Alignment offsets (MD):"
90 cat /sys/block/${MD_DEVNAME}/${MD_DEVNAME}p{1,2}/alignment_offset >> $TS_OUTPUT 2>> $TS_ERRLOG
91
92 mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>> $TS_ERRLOG
93
94 udevadm settle
95 ts_unlock "md"
96
97 ts_fdisk_clean $TS_DEVICE
98 ts_fdisk_clean $MD_DEVICE
99
100 ts_finalize