have an instance store volume(faster/cheaper) which we would like to create a volume(mkfs) when the instance is stopped and started via systemd. Is the best way for this is to have a shell script and have a systemd service call this?


It's not 100% clear to me what you want to achieve. Are you looking to instantiate (mkfs) a disk when an EC2 instance is created/booted? If that is the case, you should look into Cloud-init to mkfs and mount your disks.

  • Yes, that is what I would like to do. Right now I have a shell script that runs mkfs.ext4 /dev/xvdb and is called by a systemd.service which I created – shaolinLLama Apr 9 at 11:51
  • I think you should execute the script with cloud-init in that case. You might want to build in a loop to wait for the device to become available after launch. – Duologic Apr 9 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.