我为上一次安装(Arch Linux)编写了分区和 LVM 方案脚本,现在我想切换到 Ubuntu,但使用我以前用过的相同方案,即为/home
和/
但是,Ubuntu 安装程序似乎不允许我使用现有分区。Ubuntu 安装程序可以做到这一点吗?还是我必须通过界面来完成。我能以某种方式编写脚本吗?
编辑:我意识到我忘了将我的 usb 的分区表设置为 GPT,也许这就是为什么done
即使在添加了所需分区后也无法选择的原因。Edit2 /boot
:我用 GPT 分区表重新制作了 usb,但虽然我能够看到我之前制作的 EFI 分区,但无法让安装程序使用它。
如果我不能使用现有的分区,我至少可以做一些与 Ubuntu 18.04 中的“替代”安装程序方法等效的事情吗?我记得以前这对我有用: 在具有 UEFI BIOS 的机器上安装具有 RAID 1 和 LVM 的 Ubuntu 18.04 桌面
这是在 Arch 下适用于我的分区方案,我希望在 Ubuntu 中使用:
#!/bin/bash
yes | sgdisk --zap-all -g /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K
yes | sgdisk --zap-all -g /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E
yes | sgdisk --zap-all -g /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P
yes | sgdisk --zap-all -g /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y
#set up partitions, making sure there is a separate /boot partition so that LVM can be mounted
# I picked the value of 6144KiB based on this https://bbs.archlinux.org/viewtopic.php?pid=1385980#p1385980
yes | parted --script /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K \
mklabel GPT \
mkpart ESP fat32 6144KiB 1% \
set 1 boot on \
name 1 efi \
mkpart primary 1% 2% \
name 2 boot \
mkpart primary 2% 99% \
name 3 lvm-root
yes | parted --script /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E \
mklabel GPT \
mkpart primary fat32 6144KiB 5% \
name 1 efi-boot-backups \
mkpart primary 5% 99% \
name 2 lvm-snapshots-root
yes | parted --script /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P \
mklabel GPT \
mkpart primary 6144KiB 2% \
name 1 emergency \
mkpart primary 2% 99% \
name 2 lvm-home
yes | parted --script /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y \
mklabel GPT \
mkpart primary 6144KiB 2% \
name 1 emergency2 \
mkpart primary 2% 99% \
name 2 lvm-snapshots-home
yes| parted /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K set 3 lvm on
yes | parted /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E set 2 lvm on
yes | parted /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P set 2 lvm on
yes | parted /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y set 2 lvm on
yes | pvcreate /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part3
yes | pvcreate /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E-part2
yes | pvcreate /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P-part2
yes | pvcreate /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y-part2
yes | vgcreate main-VG /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part3
yes | vgextend main-VG /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E-part2
yes | vgextend main-VG /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P-part2
yes | vgextend main-VG /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y-part2
vgdisplay
yes | lvcreate -L 60G main-VG -n lvroot /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part3
yes | lvcreate -L 16G main-VG -n lvtmp /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part3
yes | lvcreate -L 8G main-VG -n lvswap /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part3
yes | lvcreate -L 220G main-VG -n lvhome /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P-part2
#setupsnapshots
yes | lvcreate -L 100G -s -n /dev/main-VG/root_snap01 /dev/main-VG/lvroot
yes | lvcreate -L 240G -s -n /dev/main-VG/home_snap01 /dev/main-VG/lvhome
smartctl -l scterc,70,70 /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K
smartctl -l scterc,70,70 /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E
smartctl -l scterc,70,70 /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01493P
smartctl -l scterc,70,70 /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YHNX0KC01512Y
yes | mkfs.f2fs /dev/main-VG/lvroot
yes | mkfs.f2fs /dev/main-VG/lvhome
yes | mkfs.ext4 /dev/main-VG/lvtmp
yes | mkfs.fat -F32 /dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part1
yes | tune2fs -O "^has_journal /dev/main-VG/lvtmp"
yes | mkswap /dev/main-VG/lvswap
yes | swapon /dev/main-VG/lvswap