我在将分区设置为primary类型而不是logical/extended类型时遇到了一些问题。
以下是我演示的相关代码:
d-i partman-auto/disk string /dev/sda
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-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select boot-root
d-i partman-auto-lvm/new_vg_name string vg00
d-i partman-auto/expert_recipe string \
boot-root :: \
512 512 512 ext3 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ /boot } \
. \
2048 2048 2048 swap \
$primary{ } $lvmok{ } lv_name{ lv_swap } $defaultignore{} \
method{ swap } format{ } \
. \
1024 10000 -1 ext4 \
$primary{ } $lvmok{ } lv_name{ lv_root } $defaultignore{}\
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
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
d-i partman-lvm/confirm_nooverwrite boolean true
问题是,这将创建以下分区方案:
root@ubuntu-server-1404-devit:~# fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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 identifier: 0x0009ac4d
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2000895 999424 83 Linux
/dev/sda2 2002942 20969471 9483265 5 Extended
/dev/sda5 2002944 20969471 9483264 8e Linux LVM
我想删除这个不必要的扩展/逻辑分区,让linux lvm分区位于sda2(primary)上。就像这样:
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2000895 999424 83 Linux
/dev/sda2 2002942 20969471 9483265 8e Linux LVM
最佳答案
好吧,这方面的文档非常少,但我已经弄明白了(出于某种原因,需要定义卷组名称和方法类型lvm):
d-i partman-auto/disk string /dev/sda
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-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select boot-root
d-i partman-auto-lvm/new_vg_name string vg00
d-i partman-auto/expert_recipe string \
boot-root :: \
1024 1024 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
100 1000 1000000000 ext4 \
$defaultignore{ } \
$primary{ } \
method{ lvm } \
device{ /dev/sda } \
vg_name{ vg00 } \
. \
2048 2048 2048 swap \
$lvmok{ } lv_name{ lv_swap } in_vg{ vg00 } \
method{ swap } format{ } \
. \
1024 3072 -1 ext4 \
$lvmok{} lv_name{ lv_root } in_vg{ vg00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
.
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
d-i partman-lvm/confirm_nooverwrite boolean true
关于linux - Ubuntu 14.04预置了LVM磁盘配置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33923952/