-
Notifications
You must be signed in to change notification settings - Fork 60
Compatibility with Instance Storage #17
Comments
StarCluster code had this. Perhaps start out with using all the ephemeral drives to create a logical volume and extend with EBS from there. |
This is exactly what I'm looking for. Put any ephemeral storage into BTFS to start, and expand with EBS as/if needed.
|
Here is the code I used: https://github.com/golharam/StarCluster/blob/develop/starcluster/plugins/mount_ephemeral.sh Its been a couple of years since I used this and I'm not sure ephemeral drives are still exposed the same way. |
It's a little more complicated now. Nitro based instances with NVME storage don't report those devices as |
I had a similar finding. If I use launch templates, and the storage is not defined in it, it will not appear in meta-data/block-device-mapping (regardless of how many the instance type supports, and if all possible devices are defined in the template (so as not to be specific to an instance type), all meta-data/block-device-mapping seems to be populated. My attempt at this: https://github.com/gilfreund/ec2lvm |
One of the issues is finding the correct devices name, so the code can cycle through the available devices. Using #!/usr/bin/env bash
# Requires awscli, awk, curl
InstanceType=$(curl --silent http://169.254.169.254/latest/meta-data/instance-type)
AvailabilityZone=$(curl --silent http://169.254.169.254/latest/meta-data/placement/availability-zone)
Region=${AvailabilityZone:0:9}
while read -r Architecture StorageTotal StorageDiskSize StorageDiskCount StorageDiskNVME ; do
echo "This is instance is $Architecture $StorageDiskCount x $StorageDiskSize GB disks, Total of $StorageTotal of instance storage, NVME is $StorageDiskNVME"
if [[ $StorageDiskCount -gt 0 ]] ; then
case $StorageDiskNVME in
required)
yum install -y nvme-cle
DeviceNames=$(nvme list | awk '/AWS/ { print $1 }')
;;
supported)
echo "Don't know what to do with $StorageDiskNVME mode"
;;
*)
for ((disk = 1 ; disk <= StorageDiskCount ; disk++)); do
ephemeral=$((disk - 1))
DeviceNames="/dev/$(curl --silent http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral$ephemeral) $DeviceNames"
done
;;
esac
else
echo "and has no instance storage"
fi
echo "Found $DeviceNames"
done < <(aws --region "$Region" --output text ec2 describe-instance-types --instance-types "$InstanceType" \
--query InstanceTypes[].[ProcessorInfo.SupportedArchitectures[0],InstanceStorageInfo.TotalSizeInGB,InstanceStorageInfo.Disks[0].SizeInGB,InstanceStorageInfo.Disks[0].Count,InstanceStorageInfo.NvmeSupport]) This is not foolproof, since if there are no |
@gilfreund I have expanded on your script. Currently this is independent of the autoscale itself.
I then call the autoscale install as follows:
|
Took me a while to look at this, sorry. |
In my testing across 4,5,6,i3en,i4 series instances, there has not been a problem. I moved from having EBS autoscale creating the initial device because we were hitting too many API limits, which resulted in instances failing to boot and a very large amount of abandoned EBS volumes. Now I have the initial device as part of the launch template to avoid hitting these limits. I also have some more edits to this script now as well as adding the ability to specify the threshold in the config file so that EBS only gets added once a NVMe is at 90% usage. I plan to do a PR for the threshold option. |
I see now that my naming of the devices used in the meta-data (http://169.254.169.254/latest/meta-data/block-device-mapping) was not the same in the /dev/ directory. My script ignored the device names. |
Closed #58, as it was an issue in my launch templates. The script provided by @MikeKroell works. Let me know if you need help with the PR. |
@MikeKroell 's code did not work in my case to find the root EBS volume. Can we also utilise the root volume as part of the logical volume?
|
I merged in 2.4.7 and added my script and example in #69 @bounlu you would not want to use the root volume. It already has a partition that is not BTRFS. Also, you'd want all this separate from the OS disk. |
It would be nice to be able to detect instance storage and add them to BTFS and expand as needed with EBS.
The text was updated successfully, but these errors were encountered: