-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartition.sh
executable file
·44 lines (34 loc) · 930 Bytes
/
partition.sh
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
#!/bin/bash
set -euo pipefail
TARGET_DISK=$1
readlink --verbose --canonicalize-existing "$TARGET_DISK"
echo "Target disk: $TARGET_DISK, ok?"
read -rs
# o: clear partitions
# Y yes
# n: new partition (efi boot)
# default number
# default start sector
# +256M size
# EF00 efi boot
# n: new partition (boot)
# default number
# default start sector
# +10G size
# default type
# n: new partition (system)
# default number
# default start sector
# default end sector
# default type
# w: write to disk
# Y yes
GDISK_CMDS="o\nY\nn\n\n\n+256M\nEF00\nn\n\n\n+10G\n\nn\n\n\n\n\nw\nY\n"
echo -e $GDISK_CMDS | gdisk "$TARGET_DISK"
mkfs.fat "${TARGET_DISK}1"
vgcreate system "${TARGET_DISK}3"
lvcreate --name root --size 20G system
lvcreate --name usr --size 40G system
lvcreate --name var --size 10G system
lvcreate --name tmp --size 10G system
lvcreate --name installhome --size 10G system