Currently, MAAS doesn’t support custom partitioning through the MAAS dashboard for CentOS. However, you can utilize curtin to perform this task for you.
Here’s an example /etc/maas/preseeds/curtin_userdata_centos
assuming /dev/vda
is your disk:
#cloud-config
verbosity: 3
showtrace: true
block-meta:
format: gpt
partitioning_commands:
builtin: []
01_partition_announce: ["echo", "'### Partitioning disk ###'"]
01_partition_make_label: ["/sbin/parted", "/dev/vda", "-s", "'","mklabel","gpt","'"]
02_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","1M","2M","'"]
03_partition_set_name: ["/sbin/parted", "/dev/vda", "-s", "'","set","1","bios_grub","on","'"]
04_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","2M","512M","'"]
05_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","512M","5G","'"]
06_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","5G","10G","'"]
07_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","10G","20G","'"]
08_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","20G","3500G","'"]
09_partition_make_part: ["/sbin/parted", "/dev/vda", "-s", "'","mkpart","primary","3500G","3508G","'"]
10_partition_announce: ["echo", "'### Creating filesystems ###'"]
12_partition_make_fs: ["/sbin/mkfs", "-t", "ext4", "/dev/vda2"]
13_partition_make_fs: ["/sbin/mkfs", "-t", "ext4", "/dev/vda3"]
14_partition_make_fs: ["/sbin/mkfs", "-t", "ext4", "/dev/vda4"]
15_partition_make_fs: ["/sbin/mkfs", "-t", "ext4", "/dev/vda5"]
16_partition_make_fs: ["/sbin/mkfs", "-t", "ext4", "/dev/vda6"]
17_partition_make_swap: ["sh", "-c", "mkswap /dev/vda7"]
18_partition_label_fs: ["/sbin/e2label", "/dev/vda2", "maas-boot"]
19_partition_label_fs: ["/sbin/e2label", "/dev/vda3", "maas-root"]
20_partition_label_fs: ["/sbin/e2label", "/dev/vda4", "maas-usr"]
21_partition_label_fs: ["/sbin/e2label", "/dev/vda5", "maas-var"]
22_partition_label_fs: ["/sbin/e2label", "/dev/vda6", "maas-home"]
23_partition_mount_fs: ["sh", "-c", "mount /dev/vda3 $TARGET_MOUNT_POINT"]
24_partition_mkdir: ["sh", "-c", "mkdir $TARGET_MOUNT_POINT/boot"]
25_partition_mkdir: ["sh", "-c", "mkdir $TARGET_MOUNT_POINT/usr"]
26_partition_mkdir: ["sh", "-c", "mkdir $TARGET_MOUNT_POINT/var"]
27_partition_mkdir: ["sh", "-c", "mkdir $TARGET_MOUNT_POINT/home"]
28_partition_mount_fs: ["sh", "-c", "mount /dev/vda2 $TARGET_MOUNT_POINT/boot"]
29_partition_mount_fs: ["sh", "-c", "mount /dev/vda4 $TARGET_MOUNT_POINT/usr"]
30_partition_mount_fs: ["sh", "-c", "mount /dev/vda5 $TARGET_MOUNT_POINT/var"]
31_partition_mount_fs: ["sh", "-c", "mount /dev/vda6 $TARGET_MOUNT_POINT/home"]
32_partition_announce: ["echo", "'### Filling /etc/fstab ###'"]
33_partition_make_fstab: ["sh", "-c", "echo 'LABEL=maas-root / ext4 defaults 0 0' >> $OUTPUT_FSTAB"]
34_partition_make_fstab: ["sh", "-c", "echo 'LABEL=maas-boot /boot ext4 defaults 0 0' >> $OUTPUT_FSTAB"]
35_partition_make_fstab: ["sh", "-c", "echo 'LABEL=maas-usr /usr ext4 defaults 0 0' >> $OUTPUT_FSTAB"]
36_partition_make_fstab: ["sh", "-c", "echo 'LABEL=maas-var /var ext4 defaults 0 0' >> $OUTPUT_FSTAB"]
37_partition_make_fstab: ["sh", "-c", "echo 'LABEL=maas-home /home ext4 defaults 0 0' >> $OUTPUT_FSTAB"]
38_partition_make_fstab: ["sh", "-c", "echo '/dev/vda7 none swap sw 0 0' >> $OUTPUT_FSTAB"]
debconf_selections:
maas: |
{{for line in str(curtin_preseed).splitlines()}}
{{line}}
{{endfor}}
late_commands:
maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null']
Leave a Reply
You must be logged in to post a comment.