LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   cannot mount through fstab (https://www.linuxquestions.org/questions/linux-server-73/cannot-mount-through-fstab-4175713956/)

masber 06-28-2022 04:32 AM

cannot mount through fstab
 
Dear linux community,

I am trying to mount a ceph rbd device into a linux machine.

Code:

nid001402:~ # parted -l
Model: Unknown (unknown)
Disk /dev/rbd0: 322GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End    Size  File system  Flags
 1      0.00B  322GB  322GB  ext4

This is my /etc/fstab file:

Code:

# Added by Shasta dracut module
/dev/rbd0 /scratch/local ext4 default 0 0

I can mount the device through command line:

Code:

nid001402:~ # mount -t ext4 /dev/rbd0 /scratch/local
nid001402:~ # df | grep rbd
/dev/rbd0      308587328  65564 292776740  1% /scratch/local

I then umount and try to mount based on fstab:

Code:

nid001402:~ # umount /scratch/local
nid001402:~ # mount -t ext4 -a
mount: /scratch/local: wrong fs type, bad option, bad superblock on /dev/rbd0, missing codepage or helper program, or other error.

I am unsure of this behaviour, could someone please give me a hint of what is happening and how to solve this?

thank you very much

suramya 06-28-2022 04:36 AM

I don't think you need to add the '-t ext4' to the mount -a command, since you are already specifying the filesystem in the /etc/fstab. Can you try it without it?

masber 06-28-2022 04:44 AM

also fails without the fs type

Code:

nid001402:~ # mount -a
mount: /scratch/local: wrong fs type, bad option, bad superblock on /dev/rbd0, missing codepage or helper program, or other error.


suramya 06-28-2022 05:19 AM

Hmm... What do the logs say? Check the dmesg log after running the Mount command

colorpurple21859 06-28-2022 05:28 AM

What does
Code:

fdisk -l
show

masber 06-28-2022 05:39 AM

ok, tried strace and found this

Code:

access("/run/mount", R_OK|W_OK)        = 0
mount("/dev/rbd0", "/scratch/local", "ext4", 0, "default") = -1 EINVAL (Invalid argument)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

edited fstab to

Code:

/dev/rbd0 /scratch/local ext4 noauto 0 0
and now I can run mount -a

not sure the difference between nauto and default ...

michaelk 06-28-2022 06:09 AM

The correct syntax is defaults not default. From man mount:
Quote:

defaults
Use default options: rw, suid, dev, exec, auto, nouser, async, and relatime.

Lnthink 07-01-2022 08:15 AM

I think all that's missing is that you didn't format the filesystem before you tried to mount it.
#> mkfs.ext4 /dev/rdb0
#> mkdir /scratch/local -- you probably already did this

-- ALSO change the word in fstab that says "default" to "defaults".

then you should be able to mount it.
#> mount -a


All times are GMT -5. The time now is 04:55 AM.