机器人 救救瓜
Toggle navigation
Home
SCM-tool
Linux
Jenkins
SVN
other
About Me
Archives
Tags
diskimage-builder 构建中自定义分区
? qcow2 ?
? 分区 ?
2020-08-13 15:04:24
1122
1
0
gua_l
? qcow2 ?
? 分区 ?
### 官方参考文档 > diskimage-builder code https://opendev.org/openstack/diskimage-builder >官方分区设置 > > https://docs.openstack.org/diskimage-builder/latest/user_guide/building_an_image.html > > If you wish to customise the top-level block-device-default.yaml file > from one of the block-device-* elements, set the environment variable > DIB_BLOCK_DEVICE_CONFIG. This variable must hold YAML structured > configuration data or be a file:// URL reference to a on-disk > configuration file. </br> 在自己自定义的element 的根目录下,创建一个文件block-device-default.yaml,将分区方案按yaml 文件格式配置其中,如果element 下方有一个block-device-default.yaml,则会优先使用用户定义的分区配置,如果用户无定制,则使用默认配置: https://opendev.org/openstack/diskimage-builder/src/branch/master/diskimage_builder/elements/block-device-mbr/block-device-default.yaml 或使用变量DIB_BLOCK_DEVICE_CONFIG定义分区配置,将block-device-default.yaml的文本赋值给DIB_BLOCK_DEVICE_CONFIG </br> https://github.com/GuaKing/qcow2build.git ### 官方的一个默认配置: 磁盘全部容量分配root分区,/etc/fstab 中的内容和选项可在mkfs 中定义 ``` - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot, primary ] size: 100% mkfs: mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 ``` </br> ### 多个分区的配置: ``` - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot, primary ] size: 30G mkfs: mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 - name: log size: 10G mkfs: type: ext4 mount: mount_point: /var/log fstab: options: "defaults" fsck-passno: 2 - name: crash size: 10G mkfs: type: ext4 mount: mount_point: /var/crash fstab: options: "defaults" fsck-passno: 2 ``` </br> ### LVM :多个逻辑卷的配置 ``` - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot,primary ] size: 100% - lvm: name: lvm pvs: - name: pv options: ["--force"] base: root vgs: - name: gua_vg base: ["pv"] options: ["--force"] lvs: - name: lv_log base: gua_vg size: 10G - name: lv_crash base: gua_vg size: 10G - name: lv_root base: gua_vg extents: 100%Free - mkfs: name: fs_log base: lv_log label: "cloudimage-log" type: "ext4" mount: mount_point: /var/log fstab: options: "defaults" fsck-passno: 2 - mkfs: name: fs_crash base: lv_crash label: "cloudimage-crash" type: "ext4" mount: mount_point: /var/crash fstab: options: "defaults" fsck-passno: 2 - mkfs: name: fs_root base: lv_root label: "cloudimage-root" type: "ext4" mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 ```
Pre:
/etc/fstab
Next:
ubuntu 扩展磁盘后如何扩展分区 (qcow2 vm)
1
likes
1122
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.