Last active
July 22, 2024 19:56
-
-
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
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
# 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/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I could not find the above resource for the full Python version, so I wrote one. Pasted below.