Error when mounting drive

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 ?

Answers


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.


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

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


Need Your Help

IIS Manager is working but Window is not showing up in Windows 7

windows iis-7

IIS Manager window is not showing in my machine. It is visible in taskbar but when I click on it, it is not opening or showing up. It was working previously, but stopped suddenly.

Format text in a <textarea>?

css html5 textarea html

Textareas are great because of some built in functionality (scrollbars). How can I format &lt;spans&gt; of text inside of the &lt;textarea&gt;?