Last active
August 16, 2024 06:48
-
-
Save exocode/a7e12b063f23a1ef899b23bcbfc7d123 to your computer and use it in GitHub Desktop.
Create xfs partitions on Hetzner via cloud-init. It keeps root disk available again after rebooting. Simply change your desired sizes and filesystem to use it for your needs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
resize_rootfs: false | |
disk_setup: | |
/dev/sda: | |
table_type: 'mbr' | |
layout: | |
- 25 | |
- 75 | |
overwrite: true | |
fs_setup: | |
- label: root_fs | |
filesystem: 'ext4' | |
device: /dev/sda | |
partition: sda1 | |
overwrite: true | |
- label: data_disk | |
filesystem: 'xfs' | |
device: /dev/sda | |
partition: sda2 | |
overwrite: true | |
runcmd: | |
- [ partx, --update, /dev/sda ] | |
- [ mkfs.xfs, /dev/sda2 ] | |
- [ partprobe ] | |
- parted /dev/sda set 1 boot on p | |
mounts: | |
- ["/dev/sda1", "/"] | |
- ["/dev/sda2", "/data_disk"] |
@ilyangru you are the king, if they made a statue, they would run out of concrete for your balls
The @ilyangru example very nearly worked for me as is with an Ubuntu 20.04 box, I just had to quote the "1" in the 5th runcmd. It took me longer than I'd like to figure out so hopefully that'll help someone else.
#cloud-config
# Ubuntu 18.04+
resize_rootfs: false
write_files:
- content: |
# Any text
path: /etc/growroot-disabled
runcmd:
- [ sgdisk, -e, /dev/sda ]
- [ partprobe ]
- [ parted, -s, /dev/sda, mkpart, primary, xfs, "25%", "100%" ]
- [ mkfs.xfs, /dev/sda2 ]
- [ growpart, /dev/sda, "1" ]
- [ resize2fs, /dev/sda1 ]
mounts:
- [ /dev/sda2, /var/lib/mongodb ]
Thank you folks, the very last cloud-config worked for me too. I didn't need to mount or format new partitions, but I needed two of them, so I used this line for parted:
- [ parted, -a, opt, -s, /dev/sda, mkpart, primary, "15%", "60%", mkpart, primary, "60%", "100%"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there is no /boot ext3 partition in all these suggestions
why?