linux - Ubuntu 14.04 预置 LVM 磁盘配置

标签 linux ubuntu 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 ::                                            \
              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

最佳答案

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

相关文章:

linux - Bash - 从一个文件中删除行,同时遍历另一个文件中的行

linux - 用于运行第二个 mysql 服务器的 init.d 脚本失败

tomcat - Virtualbox:无法从主机(Windows 10)访问 guest (ubuntu 15.05)中的tomcat 8080

bash - 如何限制绕过 bash ssh 隧道

ubuntu - 在新的 Ubuntu 18.04 上更改键盘键,xmodmap 不再工作?

regex - grep正则表达式如何删除单引号

PHP disk_total_space 不会测量 LVM 分区大小

linux - 为什么CapEff在/proc/$PID/status中全为零

linux - 从 Centos 6.7 升级到 7 而不会损害 LVM 中的数据

linux - 即使 ssh 连接丢失,如何让命令继续运行?