开发者

AWS - EBS Attached But Can't Find On Instance

开发者 https://www.devze.com 2023-03-27 01:36 出处:网络
I am pretty new to Amazon Web Services. I made my first EBS volume (through both the command line and the AWS web app开发者_StackOverflow社区) and attached it to a running instance at /dev/sdh as seen

I am pretty new to Amazon Web Services. I made my first EBS volume (through both the command line and the AWS web app开发者_StackOverflow社区) and attached it to a running instance at /dev/sdh as seen here. The web app shows me that it has been successfully attached to the instance. However, the folder /dev/sdh does not show up on the instance, nor does df -h reveal that it is there. What else do I need to do?

I am not sure if this helps, but the instance is an Ubuntu 11.04 Large.


Not sure if it will be the reason in your case, but we found a similar problem while integrating Fedora images in our infrastructure for BitNami Cloud Hosting.

Some kernels use /dev/xvd* instead of /dev/sd*. In your case, if you have attached the volume with device name /dev/sdh it would appear as /dev/xvdh in the machine.

I hope it helps.


When you attach a new EBS volume to an EC2 instance, there is nothing present on the volume, not even filesystem. Hence if you do df -h, it won't show up.

You should use lsblk command to list all the attached disks.

You will have to format it to make it usable. Here is the useful link for that.

Also, @CarlosSM's answer is correct that sometimes the name of the volume is different than what is specified.


  1. Use lsblk | grep disk to list all the volumes that are available.
  2. You should be able to spot the EBS volume that is available and not mounted. For example, nvme1n1 259:2 0 3.9T 0 disk.
  3. You should have /dev/nvme1n1 available.
  4. Create a mount-point, if need. For example, # mkdir /my_ebs
  5. Mount the EBS volume. # mount /dev/nvme1n1 /my_ebs
  6. df should list it now.

Enjoy!


@ajit-verma 's answer is incomplete, he forgot to format the filesystem. Otherwise it's good.

Recap:

  1. Log on as root: sudo su -
  2. Identify the device name: lsblk | grep disk
  3. Format the device: mkfs -t xfs /dev/xvdf
  4. Mount it: mkdir /var/data && chown ec2-user:ec2-user /var/data && mount /dev/xvdf /var/data
  5. Verify: df -h

Attention, don't think that if EC2 Volumes console show /dev/sdf, then your device is called the same. It's false. Follow Ajit's suggestion to find out the device name: lsblk | grep disk, then add /dev/ in front, to have your full device path.
e.g. /dev/xvdf

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号