-
Notifications
You must be signed in to change notification settings - Fork 0
/
gptbios-raid10-btrfs.sh
43 lines (34 loc) · 1.14 KB
/
gptbios-raid10-btrfs.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
#!/bin/bash
# GPT-BIOS on RAID10 with BTRFS Script
# Your setup may differ -- modify accordingly
# Exit if any command fails
set -e
# Partition the disks
for disk in a b c d; do
parted /dev/sd${disk} --script mklabel gpt
parted /dev/sd${disk} --script mkpart primary 1MiB 1GiB
parted /dev/sd${disk} --script mkpart primary 1GiB 100%
done
# Setup RAID 10
mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 /dev/sd[abcd]2
# Create Btrfs filesystem on RAID
mkfs.btrfs /dev/md0
# Create Btrfs subvolumes
mount /dev/md0 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@boot
umount /mnt
# Mount subvolumes
mount -o subvol=@ /dev/md0 /mnt
mkdir /mnt/{home,boot}
mount -o subvol=@home /dev/md0 /mnt/home
mount -o subvol=@boot /dev/md0 /mnt/boot
# Install GRUB bootloader
# pacman -S grub dosfstools mtools dialog networkmanager
# for disk in a b c d; do
# grub-install --target=i386-pc /dev/sd${disk}
# done
# sed -i 's/^HOOKS=.*/HOOKS=(base udev autodetect modconf block mdadm_udev filesystems keyboard fsck)/' /etc/mkinitcpio.conf
# mkinitcpio -P
# grub-mkconfig -o /boot/grub/grub.cfg