Last active
April 6, 2021 16:10
-
-
Save AGx10k/06f30d07ef8bc0fef8582c16f5f5a61d to your computer and use it in GitHub Desktop.
cloud-init for hetzner debian with 25% / ext4 and 75% /data xfs
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 | |
# filesystem: 'xfs' | |
# device: /dev/sda | |
# partition: sda2 | |
# overwrite: true | |
packages: | |
- xfsprogs | |
- parted | |
- lvm2 | |
# now we attach the settings | |
runcmd: | |
- [ partx, --update, /dev/sda ] | |
- [ partprobe ] | |
- parted /dev/sda set 1 boot on p | |
- resize2fs /dev/sda1 | |
- [ pvcreate, /dev/sda2 ] | |
- [ vgcreate, vg_data, /dev/sda2 ] | |
- [ lvcreate, -l, 100%FREE, -n, lv_data, vg_data ] | |
- echo sleep 10 | |
- sleep 10 | |
- [ mkfs.xfs, /dev/vg_data/lv_data ] | |
- [ mount, /dev/vg_data/lv_data, /data/ ] | |
mounts: | |
- ["/dev/sda1", "/"] | |
- ["/dev/vg_data/lv_data", "/data"] |
extend by resizing existing disk:
pvresize /dev/sdb
lvresize /dev/vg_data/lv_data /dev/sdb
xfs_growfs /data/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
extend by adding new disk:
pvcreate /dev/sdb
#### (sdc sdd and so on) (ignore errors about existing FS)vgextend vg_data /dev/sdb
lvextend /dev/vg_data/lv_data /dev/sdb
xfs_growfs /data/