You are not logged in.

#1 2012-06-01 00:22:10

paulb787
Member
Registered: 2011-10-22
Posts: 49

Auto-Mountung Ntfs Usb HDD

I am trying to set up udev to automount my externel hdd when i plug it in. i have read the udev tutorial

and have set up ntfs-3g and udev rules.

/etc/udev/rules.d/10-my-media-automount.rules

# vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules:
#
# /etc/udev/rules.d/10-my-media-automount.rules

# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end"

# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"

# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"

# global mount options
ACTION=="add", ENV{mount_options}="relatime"
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"

# automount ntfs filesystems using ntfs-3g driver
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# automount all other filesystems
ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"

# clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"

# exit
LABEL="my_media_automount_end"

when i plug in my ntfs usb harddrive i get a folder  /media/usbhd ** but it is empty. I can manually mount the drive no problem. Also i have a 128mb ntfs usb stick and that works correctly as sdb which is what my externel hdd is assigned to as well (when usb stick is not installed)? any ideas

Thank You
Paul

Last edited by paulb787 (2012-06-01 00:23:00)

Offline

#2 2012-06-01 03:53:09

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Auto-Mountung Ntfs Usb HDD

why not simply use udisks and a helper like devmon ?


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2012-06-01 13:07:35

DarkCerberus
Banned
From: Holsworthy, Devon
Registered: 2011-12-31
Posts: 252

Re: Auto-Mountung Ntfs Usb HDD

Just to alert you ntfs-3g is listed as "orphan" in the packages section which means it's no-longer maintained. If you still want ntfs-3g to work try going through this page

https://wiki.archlinux.org/index.php/NTFS-3G


Our enemies are your enemies, Nick. Disorder, war. It's just a matter of time before a dirty bomb goes off in Moscow, or an EMP fries Chicago.  ---  Alexander Pierce, Captain America: Winter Soldier
Access Denied! De-cryption failed, override denied all files sealed! --- Triskelion, Shield OS
-----
How to ask questions the smart way

Offline

#4 2012-06-22 08:37:08

paulb787
Member
Registered: 2011-10-22
Posts: 49

Re: Auto-Mountung Ntfs Usb HDD

kind of had came to come back to this .. What i dont understand is some people tell me i have to have ntfs-3g to mount/write and i am able to do that without ntfs-3g so how is that possible what am i using kernel ntfs? is that better?

Offline

Board footer

Powered by FluxBB