Skip to content

Instantly share code, notes, and snippets.

@AGx10k
Last active April 6, 2021 16:10
Show Gist options
  • Save AGx10k/06f30d07ef8bc0fef8582c16f5f5a61d to your computer and use it in GitHub Desktop.
Save AGx10k/06f30d07ef8bc0fef8582c16f5f5a61d to your computer and use it in GitHub Desktop.
cloud-init for hetzner debian with 25% / ext4 and 75% /data xfs
#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"]
@AGx10k
Copy link
Author

AGx10k commented Oct 7, 2019

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