1

我在让我的分区成为主分区而不是逻辑/扩展分区时遇到了一些问题。

这是我预置的相关代码:

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(主)上。像这样:

Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048     2000895      999424   83  Linux
    /dev/sda2         2002942    20969471     9483265   8e  Linux LVM
4

1 回答 1

6

好吧,这方面的文档非常少,但我已经弄清楚了(出于某种原因,需要定义卷组名称和方法类型 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
于 2015-11-25T21:59:41.440 回答