首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >预置未在卷组中定义物理卷

预置未在卷组中定义物理卷
EN

Ask Ubuntu用户
提问于 2019-01-14 21:42:53
回答 1查看 1.5K关注 0票数 1

几周前,我询问了如何配置Ubuntu预置来配置LVM分区。我对那件事没有反应。

我想出了如何在Ubuntu16.04桌面的预置文件中为UEFI定义逻辑卷。现在,我正在尝试设置根逻辑卷(/)所在的物理卷。我不指望有答案,但我得试一试。:)

我的预置文件中的以下d-i指令用于在基于UEFI的虚拟机上配置LVM和我的所有文件系统。

代码语言:javascript
复制
# Partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman/confirm_write_new_label boolean true
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt

d-i partman-auto-lvm/guided_size string max
d-i partman-auto/method string lvm
d-i partman-auto-lvm/new_vg_name string vg00
d-i partman-auto/choose_recipe select gpt-boot-root-swap
d-i partman-auto/expert_recipe string \
    gpt-boot-root-swap ::             \
        512 512 512 fat32             \
            $primary{ }               \
            method{ efi } format{ } . \
        1024 1024 1024 ext2              \
            $primary{ } $bootable{ }  \
            method{ format } format{ } \
            use_filesystem{ } filesystem{ ext2 } \
            mountpoint{ /boot } .                \
        1000 1000 1000000000 ext4                \
            $defaultignore{ }                    \
            $primary{ }                          \
            method{ lvm } \
            device{ /dev/sda } \
            vg_name{ vg00 } \
            . \
        1024 3072 10240 ext4 \
            $lvmok{ } \
            in_vg{ vg00 } lv_name{ lv_root } \
            method{ format } format{ }           \
            use_filesystem{ } filesystem{ ext4 } \
            mountpoint{ / } .                    \
        1024 1024 1000000000 ext4                \
            $lvmok{ }                          \
            $defaultignore{ }                    \
            in_vg{ vg00 } lv_name{ lv_delete } \
            .

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

我一直试图将加密添加到/dev/sda3 3中,这是与创建vg00卷组相关联的物理卷。我已经将以下指令添加到预设文件中

代码语言:javascript
复制
d-i partman-auto/method string crypto
d-i partman-crypto/create/partitions select /dev/sda3
d-i partman-crypto/keytype select passphrase
d-i partman-crypto/keyhash select sha512
d-i partman-crypto/keysize select 512
d-i partman-crypto/cipher select aes-xts-plain64
d-i partman-crypto/passphrase string ThisIsATest
d-i partman-crypto/passphrase-again string ThisIsATest

我通过拼凑一些零碎的东西找到了上面的东西,我可以通过网络搜索把它们拼凑在一起。

顺便说一句,如果Ubuntu真的是你的面包和黄油,你为什么没有更好的文档呢?我发现的所有东西都来自于任何Ubuntu网站以外的其他地方。

我知道有些东西不见了,但我不知道那些d-i指令会是什么。例如,为加密卷命名的d-i partman-crypto指令是什么?我肯定这是必要的。我确信这就是为什么当我试图引导我的自定义ISO时,我最终得到了错误消息

代码语言:javascript
复制
No physical volume defined in volume group
The automatic partitioning recipe contains the definition of a
volume group that does not contain any physical volume.
Please check the automatic partitioning recipe

正如我在一开始所说的那样,我不希望有人回答这个问题,因为它比我的自动分区LVM预置问题更加利基,但我必须尝试。

谢谢您能提供的任何帮助。

EN

回答 1

Ask Ubuntu用户

发布于 2020-07-31 19:43:14

你修好了吗?

代码语言:javascript
复制
d-i partman/early_command                         string \
vgs --separator=: --noheadings | cut -f1 -d: | while read vg ; do vgchange -an $vg ; done ; \
pvs --separator=: --noheadings | cut -f1 -d: | while read pv ; do pvremove -ff -y $pv ; done ; \
mdadm --detail --scan | cut -f2 -d' ' | while read array ; do umount -l $array ; done ; \
mdadm --detail --scan | cut -f2 -d' ' | while read array ; do mdadm --stop $array ; done ; \
mdadm --detail --scan | cut -f2 -d' ' | while read array ; do mdadm --remove $array ; done ; \
fdisk -l | grep 'Disk /dev/sd' | cut -f1 -d: | cut -f2 -d' ' | while read disk ; do mdadm --zero-superblock $disk ; done ; \
fdisk -l | grep 'Disk /dev/nvme' | cut -f1 -d: | cut -f2 -d' ' | while read disk ; do mdadm --zero-superblock $disk ; done ; \
fdisk -l | grep 'Disk /dev/sd' | cut -f1 -d: | cut -f2 -d' ' | while read disk ; do dd if=/dev/zero of=$disk bs=1M count=512 ; done ;
fdisk -l | grep 'Disk /dev/nvme' | cut -f1 -d: | cut -f2 -d' ' | while read disk ; do dd if=/dev/zero of=$disk bs=1M count=512 ; done ;
fdisk -l | grep 'Disk /dev/nvme' | cut -f1 -d: | cut -f2 -d' ' | while read disk ; do parted -s $disk mklabel gpt; done
# Partitioning
d-i   partman-auto/method string lvm

# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. Preseed this away
d-i     partman-lvm/device_remove_lvm boolean true

# And the same goes for the confirmation to write the lvm partitions.
d-i     partman-lvm/confirm boolean true

# Really, please don't prompt me!
d-i     partman-lvm/confirm_nooverwrite boolean true
# auto method must be lvm
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/no_swap boolean false

# Keep that one set to true so we end up with a UEFI enabled
# system. If set to false, /var/lib/partman/uefi_ignore will be touched
d-i partman-efi/non_efi_system boolean true

# enforce usage of GPT - a must have to use EFI!
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
d-i partman-auto-lvm/new_vg_name                  string vg_root

d-i partman-auto/choose_recipe select boot-root-all
d-i partman-auto/expert_recipe string \
boot-root-all :: \
1024 1024 1024 free \
$iflabel{ gpt } \
$reusemethod{ } \
method{ efi } \
format{ } \
. \
1024 1024 1024 ext2 \
$defaultignore{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
mountpoint{ /boot } \
. \
51200 51200 51200 xfs \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ / } \
. \
10240 10240 10240 xfs \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /home } \
. \
10240 10240 10240 xfs \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ /tmp } \
. \
1 1 -1 xfs                             \
        $lvmok{ }                   \
        method{ format } format{ }              \
        use_filesystem{ } filesystem{ xfs }    \
        label{ liveperson }                            \
        mountpoint{ /test }                      \
.
票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1109752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档