Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ive looked everywhere to fix this problem but I cant seem to figure out why its doing this. I have the following /etc/fstab entry to mount a ntfs partition using ntfs-3g.

UUID=01CD842715EC2180   /media/mediahd02        ntfs    defaults,user,noexec,uid=1000,gid=1000,dmask=007,fmask=117      0       2

The volume label for this partition is "MEDIA02"

So I have had no problems with the fstab mounting. The problem however is that it automounts again using MEDIA02 label. I'm not sure automounting is the right term for this as its just an empty directory. Deleting this directory and rebooting is causing it to appear again.

So listing /media I see both MEDIA02 & mediahd02

htpc@htpc:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdf1 during installation
UUID=ec027544-b0e7-4145-99a4-905543a9781a /               ext4    errors=remount-ro,noatime,discard 0       1
# swap was on /dev/sdf5 during installation
UUID=1794409e-723f-41ac-9f31-ae059f377613 none            swap    sw              0       0
# Added all the lines below this
tmpfs       /tmp        tmpfs   defaults,noatime,mode=1777  0   0
UUID=0F70-3B06  /media/mediahd01    vfat    defaults,user,noexec,uid=1000,gid=1000,dmask=007,fmask=117  0       2
UUID=01CD842715EC2180   /media/mediahd02        ntfs    defaults,user,noexec,uid=1000,gid=1000,dmask=007,fmask=117      0       2

htpc@htpc:~$ cat /etc/mtab 
/dev/sdc1 / ext4 rw,noatime,errors=remount-ro,discard 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /tmp tmpfs rw,noatime,mode=1777 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
/dev/sdc1 /media/usbhd-sdc1 ext4 rw,relatime 0 0
/dev/sdb1 /media/mediahd02 fuseblk rw,noexec,nosuid,nodev,allow_other,default_permissions,blksize=4096 0 0
/dev/sda5 /media/mediahd01 vfat rw,noexec,nosuid,nodev,uid=1000,gid=1000,dmask=007,fmask=117 0 0
/dev/sdh1 /media/Windows_7 fuseblk rw,nosuid,nodev,allow_other,blksize=4096 0 0

Can someone shed some light as to why its doing this ?

share|improve this question
    
What happens if you remove your fstab line? I would guess that the NTFS volume will get automounted as well, am I right? –  January Sep 21 '12 at 14:26
    
please post your /etc/fstab and /etc/mtab –  user91632 Sep 21 '12 at 16:09
    
Ok ive listed those two files youve asked for. –  nixgadgets Sep 22 '12 at 7:02
    
Indeed If I remove the fstab line it gets mounted automatically –  nixgadgets Sep 22 '12 at 7:03
    
One small point: At the end of the both lines with vfat and ntfs, you have 0 2. The fsck command is not reliable in Linux for those types of partitions, so you should change the final 2 to 0 instead (such as you already see for the lines with proc and swap). –  Paddy Landau Jan 29 '13 at 15:56
show 1 more comment

1 Answer

up vote 3 down vote accepted

ok classic newbie error.

I created this script /etc/udev/rules.d/11-media-by-label-auto-mount.rules during setting up of my system which is what was causing this issue. Its suppose to be automounting usb disks for my htpc while ignoring system disks.

Contents of the script:

KERNEL!="sd[b-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"

However my disk which I'm having problems with is /dev/sdb1 and hence this script takes over. I have since modified it to ignore sdb by changing the line to KERNEL!="sd[c-z][0-9]"

share|improve this answer
    
Per new user Dave: Can we please see the correction? Also, identification of the offending line in the rules.d script would be appreciated. Thanks! –  Seth Jan 29 '13 at 16:04
1  
Sorry mate. Made the change so it should be obvious now. –  nixgadgets Jan 31 '13 at 3:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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