2 # RAID support on sun disk type
4 # Copyright (C) 2008-2011 Free Software Foundation, Inc.
6 # This program 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 3 of the License, or
9 # (at your option) any later version.
11 # This program 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.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Written by Tom "spot" Callaway <tcallawa@redhat.com>
20 # Derived from an example by Jim Meyering <jim@meyering.net>
22 . "${srcdir=.}/init.sh"; path_prepend_ ../parted
25 N=2000 # number of sectors
27 exp="BYT;\n---:${N}s:file:$ss:$ss:sun:;\n1:0s:127s:128s"
28 # create an empty file as a test disk
29 dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
31 # label the test disk as a sun disk
32 parted -s $dev mklabel sun > out 2>&1 || fail=1
33 compare out /dev/null || fail=1
35 # create a single partition
36 parted -s $dev unit s mkpart ext2 0s 127s > out 2>&1 || fail=1
37 compare out /dev/null || fail=1
39 # print the partition data in machine readable format
40 parted -m -s $dev unit s p > out 2>&1 || fail=1
41 sed "s,^.*/$dev:,---:," out > k && mv k out
43 # check for expected values for the partition
44 printf "$exp:::;\n" > exp || fail=1
45 compare out exp || fail=1
48 parted -s $dev set 1 raid >out 2>&1 || fail=1
49 compare out /dev/null || fail=1
51 # print the partition data in machine readable format again
52 parted -m -s $dev unit s p > out 2>&1 || fail=1
53 sed "s,^.*/$dev:,---:," out > k && mv k out || fail=1
55 # check for expected values (including raid flag) for the partition
56 printf "$exp:::raid;\n" > exp || fail=1
57 compare out exp || fail=1