I attached an EBS volume to my EC2 instance, turned it into a EXT3 file system, and successfully mounted it. However, I was thrown off a little bit initially mainly due to what the AWS console said my EBS device ID was.
According to the AWS console:
i-xxxxxxx :/dev/sdf (attached)
I took this to mean that my attached EBS device id was /dev/sdf. So when I attempted to turn the device into a file system using this device id, I received the following error message.
ubuntu@ip-xx-xx-xx-xx:~$ mkfs -t ext3 /dev/sdf
mke2fs 1.42 (29-Nov-2011)
Could not stat /dev/sdf --- No such file or directory
The device apparently does not exist; did you specify it correctly?
Then after researching a little bit, I found this article and then subsequently found out by running cat /proc/partitions
that my true device id was /dev/xvdf not /dev/sdf.
My question is why is the AWS console saying it's /dev/sdf when it's actually /dev/xvdf? I think there has to be some kind of logical explanation for this.
The xvd in in xvdf stands for Xen Virtual block Device. This is from a question on ask Ubuntu about xvda : You are on a Xen VPS(or virtual machine); xvd* are simply the Xen disk storage devices (Xen Virtual block Device).
The device names are /dev/nvme0n1 , /dev/nvme1n1 , and so on. The device names that you specify in a block device mapping are renamed using NVMe device names ( /dev/nvme[0-26]n1 ). The block device driver can assign NVMe device names in a different order than you specified for the volumes in the block device mapping.
To attach an EBS volume to an instance using the console Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Volumes. Select the volume to attach and choose Actions, Attach volume. You can attach only volumes that are in the Available state.
AWS provides the following message/warning when attaching a volume via the AWS Management Console:
Note: Newer linux kernels may rename your devices to /dev/xvdf through /dev/xvdp internally, even when the device name entered here (and shown in the details) is /dev/sdf through /dev/sdp.
I don't have any upstream source for this information handy, but Jay Rum's answer to the (not longer relevant) temporary problem EBS Disks starting as device /dev/xvde, but mapped as /dev/sda attributes this functionality to the xen-blkfront
driver:
The "xen-blkfront" driver, which allows the virtual machines (i.e. the EC2 instances) to access the underlying block devices, traditionally mapped sda, sdb... to xvda, xvdb..., [...]
Finally, cyberx86' answer to How do I access the attached volume in Amazon EC2 provides a detailed and illustrated explanation of this device naming mismatch and how to deal with it, i.e. identify the currently available devices etc.
Note: This question had already been answered in Aug 24 '12, but that answer with 6 upvotes got deleted in May 01 '13 by the Community Moderator (i.e. a resp. automation process) for non transparent reasons (apparently because the User was removed) - anyway, I've added back a slight variation of the original content from my point of view.
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