LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-27-2010, 03:25 AM   #1
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Rep: Reputation: 19
HAL and ntfs-3g


Hi all,

I have struggled for 2 days googling how to make my GNOME desktop auto recognize the NTFS partition of the USB drive.

On command line I can do the following perfectly:

Code:
sudo mount -t ntfs-3g /dev/sda1 /mnt
which results

Code:
$ mount
...
/dev/sda1 on /mnt type fuseblk (rw,allow_other,blksize=4096)
..
All files permission on the drive is 777. I can read, I can write, do whatever I want.

But in GNOME Desktop environment, when the USB drive is plugged-in, the partition is auto-mounted with other options:

Code:
$ mount
...
/dev/sda1 on /media/IMATION type fuseblk (rw,noexec,nosuid,nodev,allow_other,default_permissions,blksize=4096)
...
All files permission on the drive is now 555. I can't write to it anymore. I saw a post earlier having similar mount result, but this one is USB drive though.

So how to configure GDE mount automatically with my intended mount options?

Thanks in advance.

Last edited by Jerry Mcguire; 01-27-2010 at 03:37 AM.
 
Old 01-27-2010, 03:41 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Can you please paste the contents of /etc/fstab and /etc/mtab file ?

Last edited by vinaytp; 01-27-2010 at 03:47 AM.
 
Old 01-27-2010, 03:55 AM   #3
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Original Poster
Rep: Reputation: 19
they are:
Code:
$ cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
/dev/VolGroup00/LogVol01 /usr                    ext3    defaults        1 2
/dev/VolGroup00/LogVol02 /var                    ext3    defaults        1 2
/dev/VolGroup00/LogVol03 /tmp                    ext3    defaults        1 2
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext2    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-hda3         swap                    swap    defaults        0 0
Code:
$ cat /etc/mtab
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/mapper/VolGroup00-LogVol01 /usr ext3 rw 0 0
/dev/mapper/VolGroup00-LogVol02 /var ext3 rw 0 0
/dev/mapper/VolGroup00-LogVol03 /tmp ext3 rw 0 0
/dev/hda2 /home ext3 rw 0 0
/dev/hda1 /boot ext2 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
I don't think it has anything to do with fstab because the USB drive wasn't there at startup.
 
Old 01-27-2010, 06:34 AM   #4
samsom
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Rep: Reputation: 15
Like you say, its not gonna be listed in your /etc/fstab as its automounted by hal.

Can you give us an output of /etc/mtab when the usb stick is automounted.
I don't know which distro you are using. I use Arch, and there are policy files in /etc/hal/fdi/policy which decide how usb memory sticks are automounted.
Have a look in that and see if you can change the filesystem type and permissions.

This is the content of my file for automounting the Ext3 partition on my SD card.


Code:
[sam@sony ~]$ cat /etc/hal/fdi/policy/20-Hero_SD_Ext3.fdi
 <?xml version="1.0" encoding="UTF-8"?>
 <deviceinfo version="0.2">
    <device>
        <match key="volume.uuid" string="9e8400b3-538c-432c-82c9-bb2ce3f6cfec">
            <merge key="volume.label" type="string">$Hero_SD_Ext3</merge>
        </match>
    </device>
 </deviceinfo>
It works "out of the box" for me. There might be a similar generic file for Ntfs-3g as I have a very similar file for the Fat32 partition as well ( Obviously with a different UUID)

Samsom

Last edited by samsom; 01-27-2010 at 06:38 AM.
 
Old 01-27-2010, 06:37 AM   #5
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
open a file to write udev rule
Code:
vim /etc/udev/rules.d/10-local.rules
Quote:
sudo mount -t ntfs-3g /dev/sda1 /mnt
How can you get usb drive in /dev/sda1 ? which is meant for 1st primary partition of your harddrive.

Define an udev rule in that file to automount your usb drive at reqd path

Code:
SUBSYSTEMS=="usb", RUN+="/bin/mount -t auto /dev/usb1 /path/to/mount/usb"
Cheers !!
 
Old 01-27-2010, 06:47 AM   #6
samsom
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Rep: Reputation: 15
Quote:
Originally Posted by vinaytp View Post
open a file to write udev rule

Define an udev rule in that file to automount your usb drive at reqd path

Code:
SUBSYSTEMS=="usb", RUN+="/bin/mount -t auto /dev/usb1 /path/to/mount/usb"
Cheers !!
Hi,
Will this work on any distro? My Fat32 partition on my SD card doesn't play along occasionally and I was trying to get an alternative to the policy file in hal.
Samsom
 
Old 01-27-2010, 08:34 PM   #7
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Original Poster
Rep: Reputation: 19
Here is the /etc/mtab when the USB drive is auto mounted in GDE:

Code:
$ cat /etc/mtab
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/mapper/VolGroup00-LogVol01 /usr ext3 rw 0 0
/dev/mapper/VolGroup00-LogVol02 /var ext3 rw 0 0
/dev/mapper/VolGroup00-LogVol03 /tmp ext3 rw 0 0
/dev/hda2 /home ext3 rw 0 0
/dev/hda1 /boot ext2 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/dev/sda1 /media/IMATION fuseblk rw,noexec,nosuid,nodev,allow_other,default_permissions,blksize=4096 0 0
It's Red Hat 5 and it is up-to-date.

The first primary disk is /dev/hda.

How to write HAL policy is quite not documented I say. The link to the spec is broken: Latest HAL specification. Please guide me somewhere if possible.

Instead of modifying udev rules, I think I will look into how HAL can be configured to mount ntfs partitions with ntfs-3g. Any ideas?
 
Old 01-28-2010, 03:16 AM   #8
samsom
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Rep: Reputation: 15
Hi,
Could you post the output of this file
/usr/share/hal/fdi/policy/10osvendor/20-ntfs-config-write-policy.fdi

This is what hal will be using to automount your ntfs partition. Just googling red hat, hal , ntfs is revealing a lot of bug reports. Not sure, if they have been fixed yet.
If there is something fairly obvious, then might be a quick fix.
Samsom
 
Old 01-29-2010, 02:51 AM   #9
Jerry Mcguire
Member
 
Registered: Jul 2009
Location: Hong Kong SAR
Distribution: RedHat, Fedora
Posts: 157

Original Poster
Rep: Reputation: 19
Thanks.
There isn't such file. The closest match is /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi

Code:
$ ls /usr/share/hal/fdi/policy/10osvendor/
10-hal_lpadmin.fdi      10-laptop-panel-mgmt-policy.fdi  15-storage-luks.fdi
10-keyboard-policy.fdi  10-power-mgmt-policy.fdi         20-storage-methods.fdi
10-keymap.fdi           10-toshiba-buttons.fdi           99-redhat-storage-policy-fixed-drives.fdi


$ grep ntfs /usr/share/hal/fdi/policy/10osvendor/*
/usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi:      <!-- allow these mount options for ntfs -->
/usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi:      <match key="volume.fstype" string="ntfs">


$ cat /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi 
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/computer">
      <append key="info.callouts.add" type="strlist">hal-storage-cleanup-all-mountpoints</append>
    </match>

    <match key="storage.media_check_enabled" bool="true">
      <append key="info.addons" type="strlist">hald-addon-storage</append>
    </match>

    <match key="volume.is_disc" bool="true">
      <match key="volume.disc.has_audio" bool="true">
        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
      </match>
      <match key="volume.disc.is_blank" bool="true">
        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
      </match>
    </match>

    <!-- this is to be able to mount media in drives we cannot poll, e.g. IDE Zip Drives and PC style floppy drives -->
    <match key="storage.media_check_enabled" bool="false">
      <match key="storage.no_partitions_hint" bool="true">

        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>

        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Mount</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">ssas</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">mount_point fstype extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-mount</append>

        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Unmount</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>

        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>

        <!-- allow these mount options for all file systems -->
        <append key="volume.mount.valid_options" type="strlist">ro</append>
        <append key="volume.mount.valid_options" type="strlist">sync</append>
        <append key="volume.mount.valid_options" type="strlist">dirsync</append>
        <append key="volume.mount.valid_options" type="strlist">noatime</append>
        <append key="volume.mount.valid_options" type="strlist">nodiratime</append>
        <append key="volume.mount.valid_options" type="strlist">noexec</append>
        <append key="volume.mount.valid_options" type="strlist">quiet</append>
        <append key="volume.mount.valid_options" type="strlist">remount</append>
        <append key="volume.mount.valid_options" type="strlist">exec</append>
        <!-- As this is removable media give some leeway -->
        <append key="volume.mount.valid_options" type="strlist">utf8</append>
        <append key="volume.mount.valid_options" type="strlist">shortname=</append>
        <append key="volume.mount.valid_options" type="strlist">codepage=</append>
        <append key="volume.mount.valid_options" type="strlist">iocharset=</append>
        <append key="volume.mount.valid_options" type="strlist">umask=</append>
        <append key="volume.mount.valid_options" type="strlist">uid=</append>

      </match>
    </match>


    <match key="volume.fsusage" string="filesystem">

      <!-- Here follow volumes we specifically want to ignore - it is the -->
      <!-- responsibility of software higher in the stack (e.g. gnome-vfs) -->
      <!-- amd mount programs (e.g. Mount() on HAL) to respect volume.ignore -->
      <merge key="volume.ignore" type="bool">false</merge>

      <match key="@block.storage_device:storage.removable" bool="false">

        <!-- Should always ignore Apple Bootstrap partitions (it would be -->
        <!-- a security hole to mount it) - TODO: should use the bootable -->
        <!-- flag from the Mac partition table instead -->
        <match key="volume.fstype" string="hfs">
          <match key="volume.label" string="bootstrap">
            <merge key="volume.ignore" type="bool">true</merge>
          </match>
        </match>

        <!-- HP ships desktops with a recovery partition -->
        <match key="volume.fstype" string="vfat">
          <match key="volume.label" string="HP_RECOVERY">
            <merge key="volume.ignore" type="bool">true</merge>
          </match>
        </match>

        <!-- EFI firmware partitions -->
        <match key="volume.fstype" string="vfat">
          <match key="volume.label" string="EFI">
            <merge key="volume.ignore" type="bool">true</merge>
          </match>
        </match>

      </match>


      <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Mount</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">ssas</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">mount_point fstype extra_options</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-mount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Unmount</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>

      <!-- allow these mount options for all file systems -->
      <append key="volume.mount.valid_options" type="strlist">ro</append>
      <append key="volume.mount.valid_options" type="strlist">sync</append>
      <append key="volume.mount.valid_options" type="strlist">dirsync</append>
      <append key="volume.mount.valid_options" type="strlist">noatime</append>
      <append key="volume.mount.valid_options" type="strlist">nodiratime</append>
      <append key="volume.mount.valid_options" type="strlist">noexec</append>
      <append key="volume.mount.valid_options" type="strlist">quiet</append>
      <append key="volume.mount.valid_options" type="strlist">remount</append>
      <append key="volume.mount.valid_options" type="strlist">exec</append>

      <!-- allow these mount options for vfat -->
      <match key="volume.fstype" string="vfat">
        <append key="volume.mount.valid_options" type="strlist">utf8</append>
        <append key="volume.mount.valid_options" type="strlist">shortname=</append>
        <append key="volume.mount.valid_options" type="strlist">codepage=</append>
        <append key="volume.mount.valid_options" type="strlist">iocharset=</append>
        <append key="volume.mount.valid_options" type="strlist">umask=</append>
        <append key="volume.mount.valid_options" type="strlist">dmask=</append>
        <append key="volume.mount.valid_options" type="strlist">fmask=</append>
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
      </match>


      <!-- allow these mount options for hfs -->
      <match key="volume.fstype" string="hfs">
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
        <append key="volume.mount.valid_options" type="strlist">force</append>
      </match>

      <!-- allow these mount options for hfsplus -->
      <match key="volume.fstype" string="hfsplus">
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
        <append key="volume.mount.valid_options" type="strlist">force</append>
      </match>

      <!-- allow these mount options for ntfs -->
      <match key="volume.fstype" string="ntfs">
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
        <append key="volume.mount.valid_options" type="strlist">gid=</append>
        <append key="volume.mount.valid_options" type="strlist">umask=</append>
      </match>

      <!-- allow these mount options for ext3 -->
      <match key="volume.fstype" string="ext3">
        <append key="volume.mount.valid_options" type="strlist">data=</append>
      </match>

      <!-- udf -->
      <match key="volume.fstype" string="udf">
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
        <append key="volume.mount.valid_options" type="strlist">umask=</append>
      </match>

      <!-- iso9660 -->
      <match key="volume.fstype" string="iso9660">
        <append key="volume.mount.valid_options" type="strlist">utf8</append>
        <append key="volume.mount.valid_options" type="strlist">uid=</append>
        <append key="volume.mount.valid_options" type="strlist">mode=</append>
        <append key="volume.mount.valid_options" type="strlist">iocharset=</append>
      </match>

      <!-- allow these unmount options -->
      <append key="volume.unmount.valid_options" type="strlist">lazy</append>

    </match>

    <!-- make sure we export Eject on discs where we don't recognize the file system -->
    <match key="volume.is_disc" bool="true">
      <match key="volume.fsusage" string="">
        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>
      </match>
    </match>

    <match key="storage.requires_eject" bool="true">
        <!-- storage Eject causes eject on each volume on this storage -->
        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Storage</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_names" type="strlist">Eject</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_execpaths" type="strlist">hal-storage-eject</append>

        <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Storage</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_names" type="strlist">CloseTray</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_signatures" type="strlist">as</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_argnames" type="strlist">extra_options</append>
        <append key="org.freedesktop.Hal.Device.Storage.method_execpaths" type="strlist">hal-storage-closetray</append>
    </match>
  </device>
</deviceinfo>

Last edited by Jerry Mcguire; 01-29-2010 at 02:53 AM.
 
Old 03-03-2011, 11:06 AM   #10
webaccounts
Member
 
Registered: May 2008
Location: Columbus Ohio
Distribution: CentOS 5.9/6.4 x64
Posts: 44

Rep: Reputation: 19
To get the automount for usb drives to go read/write for ntfs volumes I did this. This assumes you have mount -t ntfs-3g /dev/??? /mnt/??? already working.

Add or edit the file /usr/share/hal/fdi/policy/10osvendor/20-ntfs-3g-policy.fdi

Code:
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="volume.fstype" string="ntfs">
<match key="@block.storage_device:storage.hotpluggable" bool="true">
<merge key="volume.fstype" type="string">ntfs-3g</merge>
<merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
<merge key="storage.policy.should_mount" type="bool">true</merge>
<append key="volume.mount.valid_options" type="strlist">locale=</append>
<append key="volume.mount.valid_options" type="strlist">exec</append>
</match>
</match>
</device>
</deviceinfo>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual functionality of power button, HAL vs. KDE? ACPID vs HAL? Cotobear Slackware 6 09-12-2009 07:35 PM
cannot mount internal hard drive: .hal-mtab and .hal-mtab-lock messed up extremewaffles Linux - Newbie 3 07-01-2009 05:15 PM
HAL and fmask dmask in automounting ntfs-3g drives duryodhan Slackware 2 09-23-2008 02:42 PM
/media/.hal-mtab and /media/.hal-mtab-lock SlowCoder Linux - General 2 05-13-2008 04:17 PM
Make HAL use ntfs-3g duryodhan Slackware 17 10-21-2007 06:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration