Last active
January 2, 2021 22:08
-
-
Save mgoodness/c3201eb5aab2f44bdec7 to your computer and use it in GitHub Desktop.
Systemd unit file to format EBS volume
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
[Unit] | |
Description=Format EBS volume if needed | |
Before=etcd2.service | |
[Service] | |
ExecStart=/bin/bash -c \ | |
'(/usr/sbin/blkid -t TYPE=ext4 | grep /dev/xvdb) || \ | |
(/usr/sbin/wipefs -fa /dev/xvdb && /usr/sbin/mkfs.ext4 /dev/xvdb)' | |
RemainAfterExit=yes | |
Type=oneshot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, how would you use this with EC2 Userdata? Thanks