Ubuntu 预先安装 partman-auto 并使用 ssd 在 RAID 上结束 lvm

Ubuntu 预先安装 partman-auto 并使用 ssd 在 RAID 上结束 lvm

我正在尝试在 SuperMicro 服务器上预先安装 Ubuntu 16.04,该服务器有一个 32 GiB SSD 和两个 1TB 磁盘,我在 BIOS 中配置了 RAID1。

我的目标是拥有以下分区:

SSD:
2GB /boot
1 or 2GB swap
28GB /

Raid:
One lvm partition that fills the disk mounted in /opt

这是我的partman-auto预置文件:

### Partitioning
d-i partman-auto/disk string /dev/sda /dev/md126
d-i partman-auto/method string lvm

d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/purge_lvm_from_device boolean true

d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

d-i partman-auto/expert_recipe string                         \
      boot-root ::                                            \
              1500 50 2000 ext4                               \
                      $primary{ } $bootable{ }                \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      device { /dev/sda }                     \
                      mountpoint{ /boot }                     \
              .                                               \
              8000 10000 -1 ext4                              \
                      $primary{ }                             \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      device { /dev/sda }                     \
                      mountpoint{ / }                         \
              .                                               \
              1000 512 2000 linux-swap                        \
                      $primary{ }                             \
                      device { /dev/sda }                     \
                      method{ swap } format{ }                \
              .                                               \
              1024 1024 -1 ext4                               \
                      $lvmok{ }                               \
                      lv_name{ opt }                          \
                      method{ lvm } format { }                \
                      device { /dev/md126 }                   \
              .                                               \

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

但我得到的是:

~$ sudo fdisk -l
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8607ea4b

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1          63 3711737924 3711737862  1.7T 8e Linux LVM


Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 29.5 GiB, 31675383808 bytes, 61865984 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf73319fb

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sda1  *        2048  2930687  2928640  1.4G 83 Linux
/dev/sda2        2930688 46827519 43896832   21G 83 Linux
/dev/sda3       46827520 48781311  1953792  954M 82 Linux swap / Solaris
/dev/sda4       48783358 61863935 13080578  6.2G  5 Extended
/dev/sda5       48783360 61863935 13080576  6.2G 8e Linux LVM


Disk /dev/md126: 1.7 TiB, 1900411879424 bytes, 3711741952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 131072 bytes / 262144 bytes
Disklabel type: dos
Disk identifier: 0x8607ea4b

Device       Boot Start        End    Sectors  Size Id Type
/dev/md126p1         63 3711737924 3711737862  1.7T 8e Linux LVM

Partition 1 does not start on physical sector boundary.


Disk /dev/mapper/ubuntu--vg-opt: 976 MiB, 1023410176 bytes, 1998848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

我找不到任何关于这种 partman 配置(一个磁盘没有 lvm,另一个有)的文档。有没有一种简单的方法可以自动对我的服务器进行分区?

我的另一个解决方案是partman仅用于对 SSD 进行分区,然后lvm使用 shell 脚本在 raid 上进行设置post-install.sh

答案1

当你尝试完成的任务没有太多 Stack Exchange 解决方案时,你就知道你的工作很出色。我见过的所有预置文件都只能与磁盘驱动器配合使用,因为当时普遍使用的技术是旋转磁盘,而不是 SSD。哎呀,佐登!我们该怎么做?!

相关内容