You are not logged in.
Hello^^
I'm trying to mount my external USB Drive.
I put the following line in fstab:
/dev/sdb1 /media/Musik ext4 noauto,user,default 0 1
I only want to start the Harddive occasionally.
The problem is, when the drive is completly turned off during boot I get the following error:
No such file or directory while trying to open /dev/sdb1
Possibly non existend device?
I thought that the noauto Option should prevent fstab from mounting the hdd???
regards
cl10k
PS: Manual mounting works without any problems...
Last edited by cl10k (2011-03-20 22:49:43)
Offline
I don't know exactly why but I often experienced issues with USB hard drives when trying to mount them via fstab. My solution was to mount them with udev instead by putting a dedicated *.rules file in /etc/udev/rules.d. This seems to work seamlessly.
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
i agree with bohoomil about using udev instead for external drives but if you wish to keep it in fstab, you might want to make pass '0' as well; the last digit in your fstab line. not sure if it has anything to do with your problem but it just seems to make more sense since it's skipped anyway and, as you said, turned off completely at times. </my 2 cents>
Offline
@cl10k, I believe you need to add the 'nofail' option for your USB drives in fstab. The drives listed in fstab are checked at boot (fsck). A non-existent drive is a major failure!
From man mount's listed options:
nofail Do not report errors for this device if it does not exist.
So your fstab line for a USB drive should look something like this:
/dev/sdb1 /media/Musik ext4 noauto,nofail,user,default 0 2
USB NTFS partitions, using ntfs-3g, aren't checked by fsck, and 'nofail' is not a valid option for them.
Offline
Thx for your ideas!
Nofail works regarding the bootup but then fails from commandline when i try to "mount /dev/sdb1"
wrong fs type, bad option, bad superblock on /dev/sdb1
Unless you have any ideas about the new problem, I guess its time to learn how to make udev-rules.
I'll leave this thread unsolved until I really got it working with udev or fstab.
regards
Offline
Let me give you a hand then. The following I have in my /etc/udev/rules.d/11-media-by-label-auto-mount.rules, and what it does is:
-- pick the name of a drive,
-- create a dedicated /media/mountpoint name (certainly, "mountpoint" is replaced by the name of your drive),
-- mount the drive on boot,
-- unmount the drive on shutdown and delete the /media/mountpoint.
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
# Exit
LABEL="media_by_label_auto_mount_end"
Plenty of handy examples you can find in /lib/udev/rules.d/ and modify them so they meet you needs. I hope it clarifies the matter a bit.
Last edited by bohoomil (2011-03-19 16:57:36)
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Thats very kind!
Offline
I don't thinl the udev rules are going to help.
The message from the 'mount' command indicates there is a filesystem error. You should run fsck on the drive. If you're uncomfortable with the command line form of fsck, you can use gparted to check the disk.
Offline
I think the problem is that you put "default" at the end of the options, which overwrites the previous options. Try putting it at the beginning.
Offline
I tried changing the default position, but still have the same error.
My fstab line now looks like this:
/dev/sdb1 /media/Musik ext4 default,nofail,noauto,user 0 0
Fsck doesnt show any problems...
Offline
I usually mount USB drives manually, though they are listed in fstab to allow an ordinary user to mount them. I did run a test for automounting through fstab. I don't know if this information will help you.
I used this line in fstab and rebooted (I shortened the UUID for this display):
UUID=08a...bd9 /mnt/spare jfs defaults,nofail,noatime,nodiratime 0 2
When I check the mount options, this is what I have:
$ mount
...
Omitted
...
/dev/sdh8 on /mnt/spare type jfs (rw,_netdev,noatime,nodiratime)
The _netdev option surprised me. Mount's manpage says it means:
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
Offline
You should probably write "defaults" instead of "default"... Other than that, your options are starting to look like what I'm using:
LABEL=Samsung1000 /mnt/samsung1000 ext4 defaults,users,exec,noauto,noatime,commit=30 0 0
This is supposed to work even when my usb disk is unplugged, but to be honest it's always plugged in so I'm not sure if it works .
Offline
stqn is right! I should be defaultS... *facepalm*
Now everything is working perfectly.
Thanks to everyone contributing to this thread!!
kind regards
cl10k
Offline