source: install/autopart.sh @ ab298e7

Last change on this file since ab298e7 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#!/bin/bash
2#Syn-3 diskinit (C)2005 DatuX
3#-partitions all the specified discs for use with syn3
4#-erases all the data!
5#-automaticly runs initboot and initdata to initialize partitions with raid, lvm and filesystems
6
7.       dialoglib.sh || exit 1
8
9exec 2>&1
10
11
12######################## clean and partition all disks
13# Cleans and partitions all discs for Syn-3 raid.
14
15BOOT_PARTS=
16DATA_PARTS=
17for DISC in $*; do
18        echo -e "\n* Partitioning disc $DISC:"
19
20        #DISCBASE=`dirname $DISC`
21
22        #remove any existing raid disc superblocks
23        #(may fail)
24        mdadm --misc --zero-superblock --force $DISC &>/dev/null
25       
26        #remove any other confusing stuff on the disc
27        dd if=/dev/zero of=$DISC bs=1024k count=1 &>/dev/null
28       
29        #Repartitioning. Syn3 uses 2 partions:
30        #partion 1: boot partition (fixed size, mirrored over all disks )
31        #partion 2: LVM (rest of the space, mirror + spares)
32        if [ "$USE_GPT" ]; then
33                # In GPT a "Linux RAID partition" has type A19D880F-05FC-4D3B-A006-743F0F84911E
34                echo  -e "size=$SIZE_BOOT, type=A19D880F-05FC-4D3B-A006-743F0F84911E, attrs=LegacyBIOSBootable, bootable\ntype=A19D880F-05FC-4D3B-A006-743F0F84911E"|sfdisk -q -f $DISC --label gpt >/dev/null || exit 1
35        else
36                # In dos a "Linux RAID partition" has type 0xFD
37                echo  -e "size=$SIZE_BOOT, type=FD, bootable\ntype=FD"|sfdisk -q -f $DISC --label dos >/dev/null || exit 1
38        fi
39       
40        #wait for devicenames to be created
41        udevadm settle
42       
43        #determine partitions names
44        PART1=`listpartitions $DISC | head -1`
45        PART2=`listpartitions $DISC | head -2 | tail -1`
46       
47        #remove raid partition superblocks
48        #(may fail)
49        mdadm --misc --zero-superblock --force "$PART1" &>/dev/null
50        mdadm --misc --zero-superblock --force "$PART2" &>/dev/null
51       
52        #remove other confusing stuff thats in the partition           
53        dd if=/dev/zero of="$PART1" bs=4k count=1 &>/dev/null || exit 1
54        dd if=/dev/zero of="$PART2" bs=4k count=1 &>/dev/null || exit 1
55
56        #remember this parition for later
57        BOOT_PARTS="$BOOT_PARTS $PART1"
58        DATA_PARTS="$DATA_PARTS $PART2"
59done
60
61./initboot.sh $BOOT_PARTS || exit $?
62./initdata.sh $DATA_PARTS || exit $?
63
64echo -e "\n* DONE"
65#release the flying monkeys:
66exit 0
67
Note: See TracBrowser for help on using the repository browser.