Short question:
How do I know if an instance has ephemeral storage attached? Do I have to ssh
in and look at the mounts with lsblk
on Linux?
Since ephemeral storage is lost when an instance is stopped, you need to know if ephemeral drives are attached at all. The first thing to check is the "root device type" of the instance, if it is EBS, then you don't have to worry about losing data (unless the EBS volume is set to 'delete on terminate').
However, if it is "instance-store" you will lose the data on that drive when the instance starts. Then look at the "root device" and "block devices" and see if they are all associated with EBS volumes. That's easy. Where it gets cloudy, is when you attach an ephemeral drive to an instance (at launch time), but the console doesn't represent it like it does for an additional EBS volume. Further, you may need to manually mount the drive yourself...
How can you easily know from the AWS Console if an ephemeral drive is attached?
6 Answers. Save this answer. Show activity on this post. Basically, root volume (your entire virtual system disk) is ephemeral, but only if you choose to create AMI backed by Amazon EC2 instance store.
An instance store consists of one or more instance store volumes exposed as block devices. The size of an instance store as well as the number of devices available varies by instance type. The virtual devices for instance store volumes are ephemeral[0-23] .
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Instances. Select the instance. On the Storage tab, the Block devices section lists the volumes that are attached to the instance.
Ephemeral storage is the volatile temporary storage attached to your instances which is only present during the running lifetime of the instance. In the case that the instance is stopped or terminated or underlying hardware faces an issue, any data stored on ephemeral storage would be lost.
On any ec2 instance you can call an http service to query for the instance details, e.g. to see attached block devices mapping:
curl http://169.254.169.254/latest/meta-data/block-device-mapping/
to see details about a specific device:
curl http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral2
You will get the mapping of this device, e.g.: /dev/xvdb
Look in /etc/cloud/cloud.cfg
- the ephemeral should be listed there like:
mounts:
- [ ephemeral0, /media/ephemeral0, auto, "defaults" ]
- [ swap, none, swap, sw, "0", "0" ]
Then in /etc/fstab
you should see an entry like:
/dev/sda2 /media/ephemeral0 auto defaults,comment=cloudconfig 0 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With