1

我下载了 iso "CentOS-7-x86_64-GenericCloud-2009.qcow2" 用于为 kvm 容器 Proxmox 创建 Centos 7 模板。

一切正常。但是,如果我在克隆容器时分配了一个超过 2TB 的磁盘,那么 cloud-init 会将磁盘大小调整为 2TB 的限制,因为磁盘类型是 mbr 而不是 gpt。

这是我的 /etc/cloud/cloud.cfg

users:
 - default

disable_root: 0
ssh_pwauth:   0

#mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
#resize_rootfs_tmp: /dev
resize_rootfs: false
disk_setup:
  /dev/sda:
    table_type: gpt
    layout: True
    overwrite: True
fs_setup:
  - label: None,
    filesystem: ext4
    device: /dev/sda
    partition: sda1



ssh_deletekeys:   1
ssh_genkeytypes:  ~
syslog_fix_perms: ~
disable_vmware_customization: false

cloud_init_modules:
 - disk_setup
 - migrator
 - bootcmd
 - write-files
 - growpart
 - resizefs
 - set_hostname
 - update_hostname
 - update_etc_hosts
 - rsyslog
 - users-groups
 - ssh

cloud_config_modules:
 - mounts
 - locale
 - set-passwords
 - rh_subscription
 - yum-add-repo
 - package-update-upgrade-install
 - timezone
 - puppet
 - chef
 - salt-minion
 - mcollective
 - disable-ec2-metadata
 - runcmd

cloud_final_modules:
 - rightscale_userdata
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power-state-change

system_info:
  default_user:
    name: root
    lock_passwd: false
    gecos: Cloud User
    groups: [adm, systemd-journal]
    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    shell: /bin/bash
  distro: rhel
  paths:
    cloud_dir: /var/lib/cloud
    templates_dir: /etc/cloud/templates
  ssh_svcname: sshd

当我启动克隆的容器时,忽略我的 conf 并使用 mbr 将分区 / 调整为 2TB。

你能帮我吗?

4

0 回答 0