如何在partman-auto中使用“keep”方法?

如何在partman-auto中使用“keep”方法?

我有一個預置配置,對磁碟佈局有特定要求,包括分割區大小。 partman-auto 不考慮磁碟上最後一個分割區的最大分割區大小。https://wikitech.wikimedia.org/wiki/PartMan/Auto解釋了這一點以及假設的解決方法:

5. LIMITATIONS
--------------

Due to limitation of the algorithms in partman-auto, there must be at
least one partition with high maximal size so that the whole free
space can be used.  Usually you can give the partition containing
/home a maximal size 1000000000 which is high enough for the present
storage devices. If the large /home is not an option for you, you can
also define in the recipe one additional partition with size
1000000000, method "keep" and leave it unmounted.  When the
installation completes you can remove it.

Do not use higher than 1000000000 numbers because the shell arithmetic
is limited to 31 bits (on i386).

不幸的是,文件中沒有任何地方解釋「在配方中定義一個大小為 1000000000 的附加分區,方法「保留」並使其卸載」的實際含義。

我嘗試過添加

1 1000000000 1000000000 ext4 \
    method { keep } \
.

到我的分區配方的末尾,但這絕對沒有任何作用(我也嘗試過“none”和“linux”而不是“ext4”,也沒有效果)並且不知道如何繼續。

答案1

以下partman食譜對我有用。我嘗試安裝 Ubuntu 20.04

d-i partman-auto/expert_recipe string \
        efi-boot-root :: \
              256 256 256 fat32 \
                      method{ efi } \
                      format{ } \
              . \
              1024 1024 1024 ext4 \
                      $bootable{ } \
                      method{ format } \
                      format{ } \
                      use_filesystem{ } \
                      filesystem{ ext4 } \
                      mountpoint{ /boot } \
              . \
              8192 1024 8192 ext4 \
                      method{ format } \
                      format{ } \
                      use_filesystem{ } \
                      filesystem{ ext4 } \
                      mountpoint{ / } \
              . \
              8192 1024 1000000000 ext2 \
                      method{ keep } \
              .

我還必須添加此設定以避免沒有為分區指定檔案系統提示有關最終分區的資訊。

d-i partman-basicmethods/method_only boolean false

這是安裝後的磁碟分割區。 「保留」分割區填滿了磁碟上的剩餘空間。

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  256MB   255MB   fat32        EFI System Partition  boot, esp
 2      256MB   1280MB  1024MB  ext4
 3      1280MB  9473MB  8193MB  ext4
 4      9473MB  21.5GB  12.0GB

相關內容