I launched an EBS backed AMI with all the defaults.
I noticed that it automicatlly had attached an ephemeral disk.
I was just wondering if there was a good programtic way to know that this particular device is ephemeral vs some EBS volume I had decided to attach:
ubuntu@-----:~$ df -ahT
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 7.9G 867M 6.7G 12% /
proc proc 0 0 0 - /proc
sysfs sysfs 0 0 0 - /sys
none fusectl 0 0 0 - /sys/fs/fuse/connections
none debugfs 0 0 0 - /sys/kernel/debug
none securityfs 0 0 0 - /sys/kernel/security
udev devtmpfs 1.9G 12K 1.9G 1% /dev
devpts devpts 0 0 0 - /dev/pts
tmpfs tmpfs 751M 172K 750M 1% /run
none tmpfs 5.0M 0 5.0M 0% /run/lock
none tmpfs 1.9G 0 1.9G 0% /run/shm
/dev/xvdb ext3 394G 199M 374G 1% /mnt
ubuntu@-----:~$ mount
/dev/xvda1 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/xvdb on /mnt type ext3 (rw,_netdev)
If you're talking in-VM programatic way, not really; your best bet is to know they show up, where they mount, and plan accordingly.
That said, with the EC2 API you can determine what's supposed to be there. The
ec2-describe-instance
call will give you a list of block-device mappings. So long as you're playing with the API, you can create instances with the block-device mappings you want.