六、编辑seed文件
1、普通分区配置
[root@cobbler-server ~]# grep "^[^#]" /var/lib/cobbler/kickstarts/sample.seed
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string $myhostname
d-i time/zone string US/Eastern
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string ntp.Ubuntu.com
d-i mirror/country string manual
d-i mirror/http/hostname string $http_server
d-i mirror/http/directory string $install_source_directory
d-i mirror/http/proxy string
d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select fsm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/expert_recipe string \
fsm :: \
1024 100% 1024 linux-swap method{ swap } \
format{ } \
. \
2048 2048 2048 ext4 method{ format } \
mountpoint{ /home } \
format{ } use_filesystem{ } filesystem{ ext4 } \
. \
10240 10240 10240 ext4 method{ format } \
mountpoint{ / } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
768 1024 1024 ext4 method{ format } \
mountpoint{ /tmp } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
1 2048 1000000000 ext4 method{ format } \
mountpoint{ /www } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
.
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $default_password_crypted
d-i passwd/make-user boolean false
$SNIPPET('preseed_apt_repo_config')
d-i pkgsel/include string ntp ssh wget vim
d-i debian-installer/add-kernel-opts string $kernel_options_post
d-i finish-install/reboot_in_progress note
d-i preseed/early_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
/bin/sh -s
d-i preseed/late_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
chroot /target /bin/sh -s
2、lvm分区配置
绿色标记部分是最重要的,定制分区的配置,以上是普通分区方式
如果是lvm分区方式,用以下配置
d-i partman-auto/disk string /dev/sda#指定磁盘
d-i partman-auto/method string lvm#分区格式lvm还是普通分区还是raid
d-i partman-auto/choose_recipe select fsm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto-lvm/no_boot boolean true
d-i partman-auto-lvm/new_vg_name string vg0
d-i partman-auto/expert_recipe string \
fsm :: \
1024 100% 1024 linux-swap method{ swap } \
format{ } $lvmok{ } lv_name{ swap } \
. \
2048 2048 2048 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /home } lv_name{ home } \
format{ } use_filesystem{ } filesystem{ ext4 } \
. \
10240 10240 10240 ext4 method{ lvm } \
$lvmok{ } mountpoint{ / } lv_name{ root } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
768 1024 1024 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /tmp } lv_name{ tmp } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
. \
1 2048 1000000000 ext4 method{ lvm } \
$lvmok{ } mountpoint{ /www } lv_name{ www } \
format{ } use_filesystem{ } filesystem{ ext4 } \
options/relatime{ relatime } \
.
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk #保存分区

注:
$lvmok{ }必须存在,不然安装会报错无法继续
不存在这个选项cobbler又会报错
{'code': u'VFFSL(SL,"lvmok",True)',
'exc_val': NotFound(u"cannot find 'lvmok'",),
'lineCol': (60, 11),
'rawCode': u'$lvmok',
'time': 'Sun Oct 9 23:43:14 2016'}]
不知道是不是cobbler的bug
七、注意事项
1、1 2048 1000000000 ext4 method{ lvm } \ 这三个数字分别代表最少1M ,权重,最多1000000000M
如果把剩余的都分配就用三个-1,即-1 -1 -1 ext4 method{ lvm } \
2、d-i partman-auto/choose_recipe select fsm:fsm随意命名,但必须和d-i partman-auto/expert_recipe string fsm :: 这个fsm对应
3、seed文件中不能有中文哪怕是注释,不然会报错
4、每次修改/etc/cobbler/setting配置后需要执行cobbler sync进行同步
5、对于esxi的支持,默认不支持esxi6,但是可以用esxi5的kickstart文件,部分不兼容,但仍能全自动安装
八、截图

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-10/147731.htm
