1

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
  • Thanks! Doesn't seem like it: blkid -o list -c /dev/null ... /dev/xvdx ext4 (not mounted) 956b5553-d8b4-4ffe-830c-253e1cb10a2f [root@mymachine ~]# [root@mymachine ~]# ls -l /vols/data5 total 0 – yurmix Aug 1 '18 at 22:05
  • Pls show us more /etc/fstab? – slm Aug 1 '18 at 22:07
4

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 try mount /dev/xvdx /vols/data5; ls -li /vols/data5 to see whether something is mounted immediately after the mount command.

  • Bingo! Something unmounts the device. Your suggested debugging methods proved it (starting with even the ls command). – yurmix Aug 1 '18 at 22:21
  • 2
    @yurmix That something is almost certainly systemd. The developers seem to think that they know better than the actual users, and it will as a result automatically unmount anything for which a mount unit is defined but it thinks the devices needed by that unit are not ready. – Austin Hemmelgarn Aug 2 '18 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.