Answers:
因此,建立这样的系统的步骤如下:
因此,我将指导您完成以下步骤:
从http://releases.ubuntu.com/15.10/ubuntu-15.10-desktop-amd64.iso(或任何其他体系结构,如果适用)创建Live-USB记忆棒
引导实时CD(不安装)
3./4。启动第一个shell脚本,它将引导您完成以下步骤
#!/bin/bash
read -p "verify sda/sdb are the intended devices and other devices are unplugged"
sudo apt-get install gparted mdadm
read -p "create empty partitions for raid and also reserved bios gpt areas manually! Use gpt-partition tables in all steps, apply the following layout to both disks: 1MiB unformmated (bios_grub) (recommendation to leave 99MiB unallocated in case we need to do some nasty EFI stuff), remaining space unformatted partition"
sudo gparted
sudo parted /dev/sda set 1 raid on
sudo parted /dev/sdb set 1 raid on
read -p "verify non-bios partition is actual sda2 and sdb2"
sudo mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
read -p "create boot partition and empty partition for encryption"
sudo gparted
sudo cryptsetup -c aes-xts-plain64 -s 512 -h sha512 luksFormat /dev/md0p2
sudo cryptsetup luksOpen /dev/md0p2 lukslvm
sudo pvcreate /dev/mapper/lukslvm
sudo vgcreate vgubuntu /dev/mapper/lukslvm
sudo lvcreate -L 10G -n swap vgubuntu
sudo lvcreate -L 100G -n root vgubuntu
sudo lvcreate -l 100%FREE -n home vgubuntu
sudo mkswap /dev/mapper/vgubuntu-swap -L swap
sudo mkfs.ext4 /dev/mapper/vgubuntu-root -L root
sudo mkfs.ext4 /dev/mapper/vgubuntu-home -L home
echo "all done, start installation (and fix boot in chroot)"
通过安装程序安装Ubuntu(建议不要在安装时安装更新,因此,如果发生错误,请不要不必要地等待)
通过chroot切换到目标系统。为此,请打开一个新的终端窗口cd到/ media / ubuntu,并使用以下脚本准备chroot:
#!/bin/bash
read -p "verify this script is called from /media/ubuntu/ and a subfolder is used as mountpoint for the chroot root filesystem named root"
mkdir /media/ubuntu/root
#umount /media/ubuntu/bootpart
mount /dev/mapper/vgubuntu-root root
mount /dev/md0p1 root/boot/
mount -o rbind /dev root/dev
mount -t proc proc root/proc/
mount -t sysfs sys root/sys
cp /etc/resolv.conf root/etc/resolv.conf
echo "chroot setup, call 'sudo chroot /media/ubuntu/root /bin/bash' to chroot"
7./8./9。在chroot shell中使用以下脚本(在调用“ sudo chroot / media / ubunu / root / bin / bash”之后)可以:
#!/bin/bash
sudo apt-get update
apt-get install emacs mdadm
#read -p "the BIOS boot partition must be configured to be 1MiB, unformatted and having flag bios_grub"
#sudo gparted
grub-install /dev/sda
echo "reading UUID of root device /dev/md0p2"
blkid /dev/md0p2
read -p "edit crypttab add line 'lukslvm UUID=<VOLUME_ID> none luks'"
emacs /etc/crypttab
read -p "edit modules add line 'dm-crypt'"
emacs /etc/modules
update-initramfs -u -k all
read -p "add 'kopt=root=/dev/mapper/vgubuntu-root' to 'GRUB_CMDLINE_LINUX_DEFAULT' in /etc/default/grub"
emacs /etc/default/grub
sudo update-grub
您可以根据需要调整脚本中的任何大小。保存并执行它们以减少所需的时间。
顺便说一句,多亏了一个好朋友,当我真正陷入困境时,我帮助了我。
/dev/sda
失败时无法引导,因为您没有EFI引导分区/dev/sdb