Reputation: 20092
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 ?
Upvotes: 13
Views: 17682
Reputation: 13
As of the time of writing (September 2024), if I attach an EBS volume to /dev/sdf
in the AWS console, I get something like the following when running sudo lsblk -f
in the EC2 instance to which the EBS volume is attached:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 0 100% /snap/amazon-ssm-agent/7993
loop1 0 100% /snap/core18/2829
loop2 0 100% /snap/core20/2318
loop3 0 100% /snap/lxd/29351
loop4 0 100% /snap/snapd/21759
nvme0n1
├─nvme0n1p1 ext4 1.0 cloudimg-rootfs 35d001d8-e359-40ba-a20f-fd15ad377f76 15.4G 75% /
├─nvme0n1p14
└─nvme0n1p15 vfat FAT32 UEFI DDAC-8C8B 98.3M 6% /boot/efi
nvme1n1 LVM2_me LVM2 SIyc56-oGK4-MWJf-YTpY-CrWH-c8B6-QO3AVv
└─vg.01-lv_ephemeral
ext4 1.0 1110d082-c5d9-4e53-b7fb-e4dba8b93e60 216.5G 0% /opt/dlami/nvme
nvme2n1
├─nvme2n1p1 ext4 1.0 cloudimg-rootfs 35d001d8-e359-40ba-a20f-fd15ad377f76
├─nvme2n1p14
└─nvme2n1p15 vfat FAT32 UEFI DDAC-8C8B
The volume partition with name nvme2n1p1
is the one I want to mount. I can get it mounted successfully by command like
sudo mkdir -p /mnt/ebs
sudo mount /dev/nvme2n1p1 /mnt/ebs -t ext4
The point here is that: although I choose to attach it to /dev/sdf
, I need to refer it by /dev/nvme2n1p1
as displayed in the output of sudo lsblk -f
.
Upvotes: 0
Reputation: 8187
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
Upvotes: 7
Reputation: 1226
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
Upvotes: 3
Reputation: 22451
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.
Upvotes: 22