Irv
Irv

Reputation: 71

AWS EBS Volume does not mount, but no error message

I'm unable to mount an AWS EBS Volume. The name is xvdf. The Mountpoint is /home/ubuntu/disk1. The mount command produces no error, but it does not work.

Why does the mount command not mount my volume? And why doesn't the command tell me why it does not mount?

ubuntu@ip-172-31-19-142:~$ rm -rf  /home/ubuntu/disk1  # make things clear
ubuntu@ip-172-31-19-142:~$ mkdir  /home/ubuntu/disk1   # create mountpoint
ubuntu@ip-172-31-19-142:~$  lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0    8G  0 disk
└─xvda1 202:1    0    8G  0 part /
xvdf    202:80   0  100G  0 disk
ubuntu@ip-172-31-19-142:~$ sudo mount /dev/xvdf /home/ubuntu/disk1
ubuntu@ip-172-31-19-142:~$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0    8G  0 disk
└─xvda1 202:1    0    8G  0 part /
xvdf    202:80   0  100G  0 disk
ubuntu@ip-172-31-19-142:~$ uname -a
Linux ip-172-31-19-142 4.4.0-1044-aws #53-Ubuntu SMP Mon Dec 11 13:49:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ip-172-31-19-142:~$

The volume to be mounted looks fine:

ubuntu@ip-172-31-19-142:~$ sudo file -s /dev/xvdf
/dev/xvdf: Linux rev 1.0 ext4 filesystem data, UUID=badc7d94-316e-409e-b2f3-619a621ae5a2 (extents) (large files) (huge files)

Upvotes: 6

Views: 3371

Answers (3)

asmaier
asmaier

Reputation: 11756

In my case this happened because I had a wrong UUID in /etc/fstab:

$ cat /etc/fstab
LABEL=cloudimg-rootfs   /    ext4   defaults,discard    0 0
UUID=8ec04604-0e23-42d4-967e-a120f65fe4e7  /data  ext4  defaults,nofail 0 2
$ ls -la /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 80 Jan 12 17:50 .
drwxr-xr-x 4 root root 80 Jan 12 17:50 ..
lrwxrwxrwx 1 root root 11 Jan 12 17:50 4e13556e-d28d-407b-bcc6-97160eafebe1 -> ../../xvda1
lrwxrwxrwx 1 root root 10 Jan 12 17:50 b9b18cb2-9d7e-43ac-9f79-794846595e9e -> ../../xvdf

This caused that

$ sudo mount -v /dev/xvdf /data

failed silently. The strange thing is that you can mount the filesystem without problems on another mountpoint, which is not used in /etc/fstab:

$ sudo mkdir /data2
$ sudo mount -v /dev/xvdf /data2

But the real fix is to fix the wrong UUID in /etc/fstab

$ sudo nano /etc/fstab
LABEL=cloudimg-rootfs   /    ext4   defaults,discard    0 0
UUID=b9b18cb2-9d7e-43ac-9f79-794846595e9e  /data  ext4  defaults,nofail 0 2

After doing this I was able to mount the filesystem again at /data.

It can also be useful to have a look at the logfiles

$ less /var/log/syslog

Other people are suggesting to also run

sudo systemctl daemon-reload

to make mount work again.

Upvotes: 11

Irv
Irv

Reputation: 71

I had edited the /etc/fstab file. And I made a wrong entry. This resulted in the behaviour given above.

I had checked the /etc/fstab file doing a "mount -a". The were no erros, so I thought, everything was fine. But that is not correct. The mounting failed without an error on the commandline. I could find the error in the logfiles.

Thank you, lft93ryt, for the hint.

Upvotes: 1

lft93ryt
lft93ryt

Reputation: 1016

You have to create a file system with mkfs to mount the file system.

Try making a file system with mkfs.ext4 /dev/xvdf update it in the /etc/fstab and then mount it.

Upvotes: 0

Related Questions