]> Raphaƫl G. Git Repositories - distgen/blob - lib/mkfs.sh
Add slash, mail and mysql subvol
[distgen] / lib / mkfs.sh
1 #! /bin/sh -e
2
3 # Create /boot on it
4 #XXX: it seems it's not possible to boot from ext4 or xfs V5 with grub-legacy anymore
5 mkfs.ext3 -L 'boot' -U ${BOOTUUID} /dev/md/${MDBOOT}
6
7 # Create swap on it
8 mkswap -L 'swapa' -U ${SWAPAUUID} ${LOOPA}p3
9 mkswap -L 'swapb' -U ${SWAPBUUID} ${LOOPB}p3
10
11 # Create filesystem
12 mkfs.btrfs -L 'data' -U ${DATAUUID} /dev/mapper/${DATANAME}
13
14 # Make mount point
15 mkdir -p ${MOUNTPOINT}
16
17 # Mount base filesystem
18 mount /dev/mapper/${DATANAME} ${MOUNTPOINT}
19
20 # Create home subvolume
21 btrfs subvolume create ${MOUNTPOINT}/home
22
23 # Create mail subvolume
24 btrfs subvolume create ${MOUNTPOINT}/mail
25
26 # Create mysql subvolume
27 btrfs subvolume create ${MOUNTPOINT}/mysql
28
29 # Create slash subvolume
30 btrfs subvolume create ${MOUNTPOINT}/slash
31
32 # Set slash as default
33 btrfs subvolume set-default $(btrfs subvolume list ${MOUNTPOINT} | grep slash | perl -pne 's/^ID\s([0-9]+)\s.*$/\1/') ${MOUNTPOINT}
34
35 # Unmount slash filesystem
36 umount ${MOUNTPOINT}