]>
git.ipfire.org Git - thirdparty/dracut.git/blob - test/TEST-13-ENC-RAID-LVM/create-root.sh
2 # don't let udev and this script step on eachother's toes
4 for x
in 64-lvm.rules
70-mdadm.rules
99-mount-rules; do
5 > "/etc/udev/rules.d/$x"
7 rm -f -- /etc
/lvm
/lvm.conf
8 udevadm control
--reload
9 # save a partition at the beginning for future flagging purposes
10 sfdisk
-C 2560 -H 2 -S 32 -L /dev
/sda
<<EOF
17 cryptsetup
-q luksFormat
/dev
/sda2
/keyfile
18 cryptsetup
-q luksFormat
/dev
/sda3
/keyfile
19 cryptsetup
-q luksFormat
/dev
/sda4
/keyfile
20 cryptsetup luksOpen
/dev
/sda2 dracut_sda2
</keyfile
21 cryptsetup luksOpen
/dev
/sda3 dracut_sda3
</keyfile
22 cryptsetup luksOpen
/dev
/sda4 dracut_sda4
</keyfile
23 mdadm
--create /dev
/md0
--run --auto=yes --level=5 --raid-devices=3 /dev
/mapper
/dracut_sda2
/dev
/mapper
/dracut_sda3
/dev
/mapper
/dracut_sda4
24 # wait for the array to finish initailizing, otherwise this sometimes fails
27 lvm pvcreate
-ff -y /dev
/md0
&& \
28 lvm vgcreate dracut
/dev
/md0
&& \
29 lvm lvcreate
-l 100%FREE
-n root dracut
&& \
31 mke2fs
/dev
/dracut
/root
&& \
32 mkdir
-p /sysroot
&& \
33 mount
/dev
/dracut
/root
/sysroot
&& \
34 cp -a -t /sysroot
/source
/* && \
37 lvm lvchange
-a n
/dev
/dracut
/root
&& \
39 lvm vgchange
-a n dracut
&& \
42 { mdadm
-W /dev
/md0 ||
:;} && \
43 mdadm
--stop /dev
/md0
&& \
44 cryptsetup luksClose
/dev
/mapper
/dracut_sda2
&& \
45 cryptsetup luksClose
/dev
/mapper
/dracut_sda3
&& \
46 cryptsetup luksClose
/dev
/mapper
/dracut_sda4
&& \
49 echo "dracut-root-block-created"
50 for i
in /dev
/sda
[234]; do
51 udevadm info
--query=env
--name=$i|
grep -F 'ID_FS_UUID='