![Debian preseed 不会创建 lvm,但在专家配方中](https://linux22.com/image/103827/Debian%20preseed%20%E4%B8%8D%E4%BC%9A%E5%88%9B%E5%BB%BA%20lvm%EF%BC%8C%E4%BD%86%E5%9C%A8%E4%B8%93%E5%AE%B6%E9%85%8D%E6%96%B9%E4%B8%AD.png)
我在以下人员的帮助下创建了一个预置脚本这个博客我对其进行了更改以在其上创建一些逻辑卷。
脚本的结果是这样的:
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
d-i debian-installer/language string en
d-i debain-installer/country string US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i netcfg/choose_interface select auto
#d-i netcfg/choose_interface select eth0
d-i netcfg/get_nameservers string
d-i netcfg/get_ipaddress string
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string myhost
d-i mirror/country string manual
d-i mirror/http/hostname string http.nl.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i partman-auto/disk string /dev/sda /dev/sdb
d-i partman-auto/method string raid
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-auto/choose_recipe select recipe_sps
d-i partman-auto-lvm/new_vg_name string vg_sps
#d-i partman-auto-lvm/guided_size string 30GB
d-i partman-auto/expert_recipe string \
recipe_sps :: \
512 30 512 raid \
$lvmignore{ } \
$primary{ } method{ raid } \
. \
1000 35 250000000 raid \
$lvmignore{ } \
$primary{ } method{ raid } \
. \
5500 50 6000 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
. \
4000 50 4100 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ home } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /home } \
. \
4000 50 4100 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ varlog } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /var/log } \
. \
60000000 50 250000000 ext4 \
$defaultignore{ } \
$lvmok{ } \
lv_name{ varvirtualbox } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /var/virtualbox } \
.
# Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
# <devices> <sparedevices>
d-i partman-auto-raid/recipe string \
1 2 0 ext2 /boot \
/dev/sda1#/dev/sdb1 \
. \
1 2 0 lvm - \
/dev/sda2#/dev/sdb2 \
.
d-i mdadm/boot_degraded boolean false
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman/confirm_nooverwrite boolean true
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i time/zone string Europe/Amsterdam
d-i base-installer/kernel/image string linux-server
d-i passwd/root-login boolean true
d-i passwd/root-password password r00tme
d-i passwd/root-password-again password r00tme
d-i passwd/make-user boolean false
d-i user-setup/allow-password-weak boolean false
d-i user-setup/encrypt-home boolean false
d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i debian-installer/allow_unauthenticated string false
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/language-packs multiselect
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
tasksel tasksel/first multiselect standard, openssh-server
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean false
d-i grub-installer/bootdev string /dev/sda /dev/sdb
d-i finish-install/keep-consoles boolean false
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false
d-i pkgsel/include string vim openssh-server openvpn
popularity-contest popularity-contest/participate boolean false
现在我使用了该脚本,但是当它完成时(没有错误),只有引导分区、根分区和交换分区:
root@debian:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/dm-0 112G 854M 106G 1% /
udev 10M 0 10M 0% /dev
tmpfs 3.2G 8.6M 3.2G 1% /run
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/md0 472M 34M 414M 8% /boot
root@debian:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vg_sps -wi-ao---- 113.85g
swap_1 vg_sps -wi-ao---- 4.85g
但在我的专家食谱中,我也打算创建一个 /home /var/log 和 /var/virtualbox 卷。
答案1
我要更改的第一件事是“string”和“recipe_sps”之间的空格数。
根据这12.3.2.2:“第四个也是最后一个字段包含答案的值。请注意,它必须与第三个字段用一个空格分隔开;如果有多个空格,则以下空格字符被视为值的一部分”。
如果您幸运地在这个阶段最终获得了可启动系统(因此配方失败),请检查 /var/log/installer/cdebconf/questions.dat 是否包含您的配方以及是否选择了它(可能没有)。
添加:检查您的 /var/log/installer/syslog 中是否有partman消息,我的消息非常清楚:“partman-auto:可用磁盘空间(8589)对于专家配方(67595)来说太小;跳过”