I'm trying to mount a device but without success.
The strange thing is that the mount command succeeds and return exit code 0, but the device is not mounted.
Any idea on why this happens or how to investigate it?
Please see the example below:
[root@mymachine ~]# blkid -o list
device fs_type label mount point UUID
-----------------------------------------------------------------------------------------
/dev/xvda1 xfs / 29342a0b-e20f-4676-9ecf-dfdf02ef6683
/dev/xvdy ext4 /vols/data 72c23c30-2704-42ec-9518-533c182e2b22
/dev/xvdb swap <swap> 990ff722-158c-4ad5-963a-0bc9e1e2b17a
/dev/xvdx ext4 (not mounted) 956b5553-d8b4-4ffe-830c-253e1cb10a2f
[root@mymachine ~]# grep /dev/xvdx /etc/fstab
/dev/xvdx /vols/data5 ext4 defaults 0 0
[root@mymachine ~]# mount -a; echo $?
0
[root@mymachine ~]# blkid -o list
device fs_type label mount point UUID
-----------------------------------------------------------------------------------------
/dev/xvda1 xfs / 29342a0b-e20f-4676-9ecf-dfdf02ef6683
/dev/xvdy ext4 /vols/data 72c23c30-2704-42ec-9518-533c182e2b22
/dev/xvdb swap <swap> 990ff722-158c-4ad5-963a-0bc9e1e2b17a
/dev/xvdx ext4 (not mounted) 956b5553-d8b4-4ffe-830c-253e1cb10a2f
[root@mymachine ~]# mount /dev/xvdx /vols/data5; echo $?
0
[root@mymachine ~]# blkid -o list
device fs_type label mount point UUID
-----------------------------------------------------------------------------------------
/dev/xvda1 xfs / 29342a0b-e20f-4676-9ecf-dfdf02ef6683
/dev/xvdy ext4 /vols/data 72c23c30-2704-42ec-9518-533c182e2b22
/dev/xvdb swap <swap> 990ff722-158c-4ad5-963a-0bc9e1e2b17a
/dev/xvdx ext4 (not mounted) 956b5553-d8b4-4ffe-830c-253e1cb10a2f
[root@mymachine ~]#
Full fstab:
[root@mymachine ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon May 1 18:59:01 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 / xfs defaults 0 0
/dev/xvdb swap swap defaults,nofail 0 0
/dev/xvdy /vols/data ext4 defaults 0 0
/dev/xvdx /vols/data5 ext4 defaults 0 0
Best Answer
Normally mount doesn't return 0 if there have been problems. When I had a similar problem, the reason was that systemd unmounted the filesystem immediately after the mount.
You can try
strace mount /dev/xvdx /vols/data5
to see the result of the syscall. You can also trymount /dev/xvdx /vols/data5; ls -li /vols/data5
to see whether something is mounted immediately after the mount command.