12

I created an EC2 amazon instance (ubuntu) and created a volume from an available snapshot. The volume has been successfully attached to my instance as /dev/sdf.

I executed the following command: performed: mkdir /space

When I try to execute the following command: sudo mount /dev/sdf1 /space

I get this message: mount: special device /dev/sdf1 does not exist

How can I solve this issue ?

4

3 回答 3

21

Try mounting the device "/dev/sdf" instead of "/dev/sdf1".

If that still doesn't work, try mounting it as "/dev/xvdf" or "/dev/xvda1", e.g.:

sudo mount /dev/xvda1 /space

The explanation for this name mismatch can be found in the "Attach Volume" dialog of the EC2 management screen:

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.

于 2012-09-22T17:23:05.987 回答
5

Complementing David Levesque answer.

You can check which volumes have been mounted with. The following will list them all:

$ sudo lsblk --output NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,LABEL

You will get something like that

NAME    TYPE SIZE FSTYPE MOUNTPOINT LABEL
xvda    disk   8G                   
└─xvda1 part   8G ext4   /          cloudimg-rootfs
xvdf    disk  30G                   
└─xvdf1 part  30G ext4              cloudimg-rootfs

Then you can mount it with

$ sudo mount /dev/xvdf1 /space -t ext4

I hope it helps

于 2018-08-08T05:19:25.523 回答
3

In my CloudFormation UserData section I had the attach-volume command and mount command execute sequentially without a delay. I introduced a 5 second delay between the attach-volume command and mount command and it solved the problem.

aws ec2 attach-volume --volume-id $volumeId --instance-id $instanceId --device /dev/xvdf
sleep 5
mount /dev/xvdf /db -t ext4
于 2016-02-11T00:40:09.517 回答