Skip to content

Instantly share code, notes, and snippets.

@andreas-wilm
Last active July 22, 2024 19:56
Show Gist options
  • Save andreas-wilm/3460a788d6548370a136e63b5b91281e to your computer and use it in GitHub Desktop.
Save andreas-wilm/3460a788d6548370a136e63b5b91281e to your computer and use it in GitHub Desktop.
Combine all NVMs on AWS instance (e.g. i3) as raid0 and mount as data
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/raid-config.html
nvmes=$(sudo lsblk | awk '/^nvme/ {printf "/dev/%s ", $1}')
sudo mdadm --create --verbose /dev/md0 --level=0 --name=my_raid --raid-devices=$(echo $nvmes | wc -w) $nvmes
sleep 10# crutch
sudo mkfs.ext4 -L my_raid /dev/md0
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
sudo dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
sudo mkdir /data
sudo mount LABEL=my_raid /data
sudo chown ec2-user:ec2-user /data/
@siddharthab
Copy link

Note that if using the above with AWS Batch, you will need to wrap the above in MIME.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment