Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#27649 closed enhancement (fixed)

ntfs-3g: show mount in finder

Reported by: markus.doits@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: pokui@…, drkp (Dan Ports), neverpanic (Clemens Lang), pixilla (Bradley Giesbrecht), ozaktash@…, khepler
Port: ntfs-3g

Description

i just got ntfs-3g to automount my volumes by replacing "/sbin/mount_ntfs" by "ntfs-3g"

mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
ln -s /opt/local/bin/ntfs-3g /sbin/mount_ntfs

this makes ntfs-3g automount my ntfs-volumes. but they don't show up in finder.

since there is the ntfs-3g-version for mac from tuxera (http://www.tuxera.com), where the volumes show up in finder, i searched in their code a little bit and found this in "ntfs-3g.c":

#if defined(__APPLE__) || defined(__DARWIN__)
        /* If the volume has a volume name, then append the MacFUSE-specific
         * 'volname' option, making the volume name appear in Finder. */
        if (ctx->vol->vol_name) {
                int i;
                size_t vol_name_len = strlen(ctx->vol->vol_name);
                char *scrubbed_vol_name =
                        calloc(1, sizeof(char) * (vol_name_len + 1));
                if (scrubbed_vol_name == NULL)
                        goto err_out;

                /* Scrub all ',' characters from the volume name since they
                 * would interfere with FUSE argument delimiters. */
                for (i = 0; i < vol_name_len; ++i) {
                        char cur = ctx->vol->vol_name[i];
                        if(cur == ',')
                                scrubbed_vol_name[i] = '_';
                        else
                                scrubbed_vol_name[i] = cur;
                }

                scrubbed_vol_name[i] = '\0';

                if (strappend(&parsed_options, ",volname="))
                        goto err_out;
                if (strappend(&parsed_options, scrubbed_vol_name))
                        goto err_out;

                free(scrubbed_vol_name);
        }
#endif /* defined(__APPLE__) || defined(__DARWIN__) */

maybe this could be adapted by/added to the ntfs-3g macports version so the volumes show up in finder?

don't know whether they use a special macfuse or the "volname"-option is standard.

for reference, the latest source of tuxera ntfs-3g for mac can be found here: http://sourceforge.net/projects/catacombae/files/NTFS-3G%20for%20Mac%20OS%20X/2010.10.2/:

(so there's an updated version of ntfs-3g out, too: 2010.10.2. will open another ticket for update)

Attachments (6)

Portfile.diff (323 bytes) - added by markus.doits@… 13 years ago.
show_in_finder.diff (1.7 KB) - added by markus.doits@… 13 years ago.
to place in /files/
mount_ntfs (82 bytes) - added by markus.doits@… 13 years ago.
replace of /sbin/mount_ntfs
auto_mount.diff (1.6 KB) - added by markus.doits@… 13 years ago.
small fix for hardcoded prefix
mount_ntfs.2 (470 bytes) - added by markus.doits@… 13 years ago.
to place in /files/mount_ntfs and to use with auto_mount.diff
mount_ntfs.2.2 (469 bytes) - added by markus.doits@… 13 years ago.
small fix for hardcoded prefix and typo

Download all attachments as: .zip

Change History (47)

comment:1 Changed 13 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added
Owner: changed from macports-tickets@… to petri@…
Port: ntfs-3g added
Version: 1.9.2

comment:2 Changed 13 years ago by mf2k (Frank Schima)

ntfs-3g was updated to version 2010.10.2 in r 74328.

Version 0, edited 13 years ago by mf2k (Frank Schima) (next)

comment:3 Changed 13 years ago by markus.doits@…

here's an untested patch (compiled fine, but no ntfs-volume here to test it). I will report back in some hours after a test mount, but it looks good and should work.

Changed 13 years ago by markus.doits@…

Attachment: Portfile.diff added

Changed 13 years ago by markus.doits@…

Attachment: show_in_finder.diff added

to place in /files/

comment:4 Changed 13 years ago by markus.doits@…

unfortunately it seems not be easy like this. it mounts but still doesn't show up in finder. maybe someone has an idea why?

comment:5 Changed 13 years ago by markus.doits@…

i just compiled the full ntfs-mac package (the one tuxera uses and the above patch is from) with the macfuse 2.0.3 of macports, and mounting directly with the newly compiled "./ntfs-3g /dev/volume /Volumes/name" (with all their patches) shows no result in finder, either.

so looks like the problem lies elsewhere (maybe macports macfuse)? or is the mounting by "ntfs-3g" directly wrong?

at least macfuse says it supports a user space volname option, https://code.google.com/p/macfuse/wiki/OPTIONS

i'm clueless for now.

comment:6 Changed 13 years ago by markus.doits@…

alright, i got it to work. there were different things.

  1. the patch above is working: the volname-option is successfully appended to the mount options.
  1. you have to use "-o local,auto_xattr" in addition to the patch to show the volume in finder
  1. because of auto_xattr, i think the extended attributes of ntfs-3g should be disabled by "-o streams_interface=none" (which is obviously a drawback if you need them).

See https://code.google.com/p/macfuse/issues/detail?id=370 that directed me to the solution (and also why i think "streams_interface=none" should be used - but i have to little knowledge of ntfs(-3g) and macfuse if it is really necessary)

I'm now using a special "mount_ntfs"-shell-script with the provided volname-patch - and my ntfs-automounts show up in finder.

Anyone with some knowledge about filesystems/ntfs-3g/macfuse can say something this approach? Is "streams_interface=none" really needed?

I could think of this solution provided as port-variants of ntfs-3g ("+auto_mount=enables auto_mount by ntfs-3g", "+show_in_finder=shows mounts in finder BUT disables ntfs xattr")

Changed 13 years ago by markus.doits@…

Attachment: mount_ntfs added

replace of /sbin/mount_ntfs

comment:7 Changed 13 years ago by markus.doits@…

finally, below is another fully working attempt.

  • ntfs-3g does not need to be patched
  • it's all done by a shell script

before going into details, first let me say that the "auto_xattr"-option is even used by the mount-script from tuxera in macntfs-3g, so should be safe.

the patch to the portfile does the following:

  • copy a mount_ntfs-shell-script to ${prefix}/sbin/mount_ntfs and chmod 755
  • add a variant display what to do after installation if you want the automount to happen

the files/mount_ntfs mounts ntfs-volumes correctly to display them in the finder, see the comments inside

there's no error checking nor displaying when something goes wrong, but that could be implemented if needed.

any comments?

Changed 13 years ago by markus.doits@…

Attachment: auto_mount.diff added

small fix for hardcoded prefix

Changed 13 years ago by markus.doits@…

Attachment: mount_ntfs.2 added

to place in /files/mount_ntfs and to use with auto_mount.diff

Changed 13 years ago by markus.doits@…

Attachment: mount_ntfs.2.2 added

small fix for hardcoded prefix and typo

comment:8 Changed 13 years ago by markus.doits@…

this is getting messy... no way to delete attachments?!

so the files to use for my last attempts are:

comment:9 Changed 13 years ago by pokui@…

Cc: pokui@… added

Cc Me!

comment:10 Changed 13 years ago by markus.doits@…

any progress on reviewing here? hadn't have any issues using my patch for the last days (occasionally accessing ntfs-usb-sticks). any other successful tester?

comment:11 Changed 13 years ago by petri@…

Will be taking a look after the worst part of the holidays have passed by. Not that I can guarantee a perfect answer. :) But still, I and openmaintainer are maintainers.

comment:12 in reply to:  6 Changed 13 years ago by petri@…

Replying to markus.doits@…:

  1. you have to use "-o local,auto_xattr" in addition to the patch to show the volume in finder

The patch file seems to be fine; however, I don't think we should automatically set local as per question 4.1 in the MacFUSE FAQ. Doing so would cause creation of various OS X-specific directories, for instance, just because you mounted the volume. This might not what most people want, no? There is however a suggestion to make the Finder show networked volumes, perhaps this should be notified to the user during install.

comment:13 in reply to:  6 ; Changed 13 years ago by petri@…

Replying to markus.doits@…:

  1. because of auto_xattr, i think the extended attributes of ntfs-3g should be disabled by "-o streams_interface=none" (which is obviously a drawback if you need them).

Actually, Tuxera's documentation regarding EAs suggests that if you use auto_xattr, then you could expose streams through streams_interface=openxattr. The docs seem to suggest that unless that is used, auto_xattr would not work as expected. I am wondering whether EAs are useable for most people though, I'm not used to working with them nor alternate streams. Any thoughts?

comment:14 in reply to:  13 ; Changed 13 years ago by markus.doits@…

Replying to petri@…:

The patch file seems to be fine; however, I don't think we should automatically set local as per question 4.1 in the MacFUSE FAQ. Doing so would cause creation of various OS X-specific directories, for instance, just because you mounted the volume. This might not what most people want, no? There is however a suggestion to make the Finder show networked volumes, perhaps this should be notified to the user during install.

I see, local is no option then. Unfortunately as per macfuse faq 4.3, there is no way to show up the volume in finder's sidebar then. But at least it can be shown on the desktop as a remote drive, which is better than nothing.

Replying to petri@…:

Actually, Tuxera's documentation regarding EAs suggests that if you use auto_xattr, then you could expose streams through streams_interface=openxattr. The docs seem to suggest that unless that is used, auto_xattr would not work as expected. I am wondering whether EAs are useable for most people though, I'm not used to working with them nor alternate streams. Any thoughts?

So you (or Tuxera) suggest(s) adding streams_interface=openxattr to the mount options? If so, let's do it. Since I haven't dealt with ntfs streams yet, I cannot say anything about them.

So to summarize: remove local, add streams_interface=openxattr are the changes to be made to the existing patch. Then we get a mount where streams should work(?) and the volume shows up as a network device on the desktop (if enabled as a preference in finder).

comment:15 in reply to:  14 Changed 13 years ago by petri@…

Replying to markus.doits@…:

So you (or Tuxera) suggest(s) adding streams_interface=openxattr to the mount options? If so, let's do it. Since I haven't dealt with ntfs streams yet, I cannot say anything about them.

I'm not suggesting it, rather I interpreted Tuxera's docs to be suggestive of that. However, I don't think it would do any harm, which is why I'd consider it.

So to summarize: remove local, add streams_interface=openxattr are the changes to be made to the existing patch. Then we get a mount where streams should work(?) and the volume shows up as a network device on the desktop (if enabled as a preference in finder).

Yes, but still, this is going outside of DESTROOT and I'm unsure how to nicely handle that (actually, I think MacPorts shouldn't in general meddle with OSX-installed files, but to implement this variant we'd have to). I'll have to look that up, and perhaps do some asking around.

comment:16 Changed 13 years ago by petri@…

Oh, and they have just released a new version of ntfs-3g, 2011.1.15 (see #28102).

comment:17 Changed 13 years ago by markus.doits@…

i just found https://groups.google.com/group/macfuse/browse_thread/thread/075261ef25ecf7ae - there is a apple script about adding the volume to the sidebar. This could be called by the shell script automatically after mounting the volume. Unfortunately I cannot get the applescript to work, because I get many syntax errors in my applescript editor (didn't do anything with applescript yet) and I don't know what is wrong.

And about the DESTROOT: Thats why the variant is actually only a comment for the user what to do after installation. Macports does not automatically do something out of DESTROOT (it can't by design, I think). So I do not see an easier solution, but maybe you can think of one.

comment:18 in reply to:  17 Changed 13 years ago by mf2k (Frank Schima)

Replying to markus.doits@…:

And about the DESTROOT: Thats why the variant is actually only a comment for the user what to do after installation. Macports does not automatically do something out of DESTROOT (it can't by design, I think). So I do not see an easier solution, but maybe you can think of one.

It is allowed but to be avoided if possible. The macfuse port does it though for example. You should add this to the portfile:

destroot.violate_mtree yes

In fact, the ntfs-3g portfile has that line commented out.

comment:19 Changed 13 years ago by mf2k (Frank Schima)

@ petri: I've updated the ntfs-3g portfile to the latest version. Let me know what you want done here, preferably with an updated portfile patch, and I will be happy to commit it. I don't see making changes outside of DESTROOT being a dealbreaker for a port such as this.

comment:20 Changed 13 years ago by markus.doits@…

it isn't only placing a file outside DESTROOT but replacing one belonging to the base mac os system.

Is there a portfile command that can do something like "back up a file outside DESTROOT and move it out of the way" on port activation and "put the backup back to it's place" on port deactivation (the file would be /sbin/mount_ntfs)? Then there would be no manual steps involved and a variant could be provided doing this.

comment:21 Changed 13 years ago by mf2k (Frank Schima)

I see. If you are using the sqlite registry, then there are the pre-deactivate and post-deactivate phases which would work. So the variant should say that the sqlite registry is required.

comment:22 Changed 13 years ago by petri@…

@macsforever: Thanks for the update in general, and the pointers to breaking DESTROOT and the sqlite registry. Will look into it this week(end), especially the sqlite registry issue is new to me (any docs pointers would be helpful!), so if all goes well, expect a new patch from me in not too long a timeframe.

comment:23 Changed 13 years ago by mf2k (Frank Schima)

Sounds good.

comment:24 Changed 13 years ago by mf2k (Frank Schima)

@petri: I have updated ntfs-3g to version 2011.4.12 in r81181. Also the sqlite registry is now required for Macports 2.0.0. Can you update your patch(es)?

comment:25 Changed 13 years ago by drkp (Dan Ports)

Cc: dports@… added

The latest update caused it to start installing mkfs.ntfs into /sbin, which is both undesirable and (I assume) unintended. I fixed it in r81239.

comment:26 Changed 13 years ago by neverpanic (Clemens Lang)

Apparently the downloadable binary version of NTFS-3g uses the DiskArbitration Framework for this and can achieve auto-mounting without overwriting /sbin/mount_ntfs. Have a look at /sbin/mount_ntfs-3g if you have it installed.

comment:27 Changed 13 years ago by neverpanic (Clemens Lang)

Cc: cal@… added

Cc Me!

comment:28 Changed 13 years ago by petri@…

@macsforever and the rest of y'all contributers :) : I had an accident with broken bones and stuff, so I've yet to catch up with any port-related mail (or most mail, in general). I'm fine now though, although it took many months to resolve, so could you/anyone summarize what you think is left to be done?

comment:29 Changed 13 years ago by petri@…

cal: Not that confident with the DA frameworks, but if someone whips up a nice patch I could help test it.

comment:30 in reply to:  description Changed 13 years ago by greg@…

I found this article which has a script for mount-ntfs that automounts NTFS-3g volumes on the desktop and in the Finder sidebar (with a minor caveat):

http://fernandoff.posterous.com/ntfs-write-support-on-osx-lion-with-ntfs-3g-f

It does work, as I tested it with April's NTFS-3g release. Unfortunately, installing Fuse4x and NTFS-3g with MacPorts doesn't work as well as the Tuxera 10-2010 release. Specifically, copying a folder from one volume to another with the Finder only copies the folder, not the contents (not recursive). Which makes it pretty worthless for me. Also, the finder reports the format as "Unknown(fuse4x)" so fuse4x is not providing the finder with the "NTFS" descriptor - is NTFS-3g providing that to fuse4x?

All free NTFS-3g solutions are incredibly slow compared to the paid solutions.

comment:31 Changed 12 years ago by petri@…

Just a quick note: changed my email from …@netatonce.net to …@kelotti.net. Assignment is wrong thusly.

comment:32 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Owner: changed from petri@… to petri@…

comment:33 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Cc: pixilla@… added

Cc Me!

comment:34 Changed 10 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… removed
Owner: changed from petri@… to macports-tickets@…

This port is no longer maintained.

comment:35 Changed 10 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed

I have placed instructions in the wiki to make it work with the Finder. And I added a pointer to that in the notes field in r119583.

comment:36 Changed 10 years ago by ozaktash@…

A little annoyance has emerged recently:

Using the script in the wiki, the mount point is not removed anymore after unmount. This results in creation of a new folder in /Volumes/ with the name "%MOUNT_POINT_NAME 1", "%MOUNT_POINT_NAME 2" ... etc. each time the drive is re-mounted.

It seems to me that this issue has appeared after osxfuse replaced fuse4x.

I am on OS X 10.9.2 by the way with MacPorts 2.2.1.

comment:37 Changed 10 years ago by ozaktash@…

Cc: ozaktash@… added

Cc Me!

comment:38 in reply to:  36 ; Changed 10 years ago by khepler

Replying to ozaktash@…:

Using the script in the wiki, the mount point is not removed anymore after unmount. This results in creation of a new folder in /Volumes/ with the name "%MOUNT_POINT_NAME 1", "%MOUNT_POINT_NAME 2" ... etc. each time the drive is re-mounted.

Looks like that will be fixed in osxfuse 3.0: https://github.com/osxfuse/osxfuse/issues/119


Regarding the mount_ntfs script

http://apple.stackexchange.com/questions/106589/write-in-ntfs-using-mavericks and http://coolestguidesontheplanet.com/how-to-write-to-a-ntfs-drive-from-os-x-mavericks/ show Homebrew providing a mount_ntfs script. I don't use Homebrew, so I can't tell where that comes from. I believe Homebrew patches it in, and it is not provided by the ntfs-3g package proper.

In a similar vein, could we have the port install the wiki's mount_ntfs script somewhere? It would avoid (error-prone) copy+paste steps for users, who would symlink it when desired, and allow Macports to version the thing.

comment:39 Changed 10 years ago by khepler

Cc: khepler@… added

Cc Me!

comment:40 in reply to:  38 Changed 10 years ago by ozaktash@…

Replying to khepler@…:

Replying to ozaktash@…:

Using the script in the wiki, the mount point is not removed anymore after unmount. This results in creation of a new folder in /Volumes/ with the name "%MOUNT_POINT_NAME 1", "%MOUNT_POINT_NAME 2" ... etc. each time the drive is re-mounted.

Looks like that will be fixed in osxfuse 3.0: https://github.com/osxfuse/osxfuse/issues/119

Yes I have been watching that. It looks like we have to wait until osxfuse 3.0 is released and makes its way into macports.


Regarding the mount_ntfs script

http://apple.stackexchange.com/questions/106589/write-in-ntfs-using-mavericks and http://coolestguidesontheplanet.com/how-to-write-to-a-ntfs-drive-from-os-x-mavericks/ show Homebrew providing a mount_ntfs script. I don't use Homebrew, so I can't tell where that comes from. I believe Homebrew patches it in, and it is not provided by the ntfs-3g package proper.

In a similar vein, could we have the port install the wiki's mount_ntfs script somewhere? It would avoid (error-prone) copy+paste steps for users, who would symlink it when desired, and allow Macports to version the thing.

I totally agree with this!

comment:41 Changed 10 years ago by mf2k (Frank Schima)

Adding comments to closed tickets is not likely to get anything accomplished. Please open a new ticket with this request and ideally a patch since this port is not maintained.

Note: See TracTickets for help on using tickets.