Jump to content

[How to] Automount NTFS-partition using (newest) ntfs-3g.


9 posts in this topic

Recommended Posts

In this tutorial i will explain my method to automount your ntfs partition using ntfs-3g. There were packages which did this for you (made by shadowofged), but as many of you might know, (almost) all links to them are dead. But thankfully I have found a workaround to automount your disk (A).

 

NOTE: This will only work with disks that are already connected at boot-time.

You will need macFuse Core installed (download it here) and ntfs-3g (i would recommend to compile it on you own using xCode and this tutorial. I do not garranty if it works with precompiled ntfs-3g stuff)

Following this tutorial is completely at your own risk! (though i consider it quite safe)

 

Now lets begin with the tutorial!

First we make a little shell-script which does all the steps for mounting the disk. Make a plain text document with this commands inside:

 

#!/bin/bash

/usr/sbin/diskutil unmount /dev/disk0s1
/bin/mkdir /volumes/data
/sw/bin/ntfs-3g /dev/disk0s1 /volumes/data -o volname=Data

 

save it as "ntfs_mount.command" in "/ntfs_mount" or where-ever you like.

to make "ntfs_mount.command" executable, go into terminal. browse to the folder where you saved it, and do

chmod +x ntfs_mount.command

 

IMPORTANT NOTES:It is important that you give full paths! (so not just "mkdir", but "/bin/mkdir") This is necessary for cron (explained later) to work. You should replace disk0s1 for your partitions identifier (use Disk Utility to determine it). Instead of data you can name the directory whatever you like. the volname=Data sets the name with which it appears on you desktop and in finder. Name it whatever you like. Depending on how you installed ntfs-3g, it may or may not reside in "/sw/bin/ntfs-3g", if not, then change it to the right path.

 

Now we need to make ntfs-3g executable for normal users (sudo won't be needed anymore. And there won't be a flag needed anymore for the privilege problem when copying to the disk)

Open the terminal, browse to the directory containing ntfs-3g (in my case its "/sw/bin/ntfs-3g") and type:

sudo chmod u+s ntfs-3g

 

If everything worked right you should double click ntfs_mount.command from finder. It will unmount the disk if it is already mounted (no matter if it's ntfs-3g or normal ntfs mounted) and directly remount it using ntfs-3g with read/write support!

NOTE: you shouldn't go any further before you get this working! If it doesn't work you might consider to replace

#!/bin/bash

with

#!/bin/sh

 

Now we need to make this script automatically run at boot up. We use cron for this. The big plus of cron is, that it won't open you terminal and leave it open (which "Login Items" would do for example). Open a terminal and type:

cd /etc
sudo nano crontab

 

and add this line:

@reboot		koen	/mount_ntfs/mount_ntfs.command

replace "koen" with you user name.

Save the file (using Control + O). If you did everything right it should launch the shell script on boot up, so you ntfs partition will be automatically mounted. I would say: give it a try and remount!

Enjoy!

 

Greetings Koen

 

P.s. please let me know if you have any suggestions or comments. And please let me also know if it works for you...

Link to comment
Share on other sites

  • 2 weeks later...
i did everything you said and the command file works but it does nothing at start up...

Edit: I used this program and it worked

 

Wonkajh, this is a good alternative to use instead of cron (which normally takes care of executing the shellscript at boot up). In fact, you might even call it a better thing than using cron. Because since tiger "cron" is mostly replaced (and thus cron is becoming "outdated") by launchd. Cron is for me easier to use though...

 

Greetings.

 

P.s. NTFS-3g 1.710 is out! An OS X version is available using Fink! I'll try it one of these days.

Link to comment
Share on other sites

once uve complied 1.7 plz post it :huh:

 

Sorry but i don't know how to make a .pkg which contains it. Also i don't know if it needs to contain more than the ntfs-3g binary (which it probably will). I just don't have the knowledge for making such a packet. Though i do know that compiling on your own is best for performance, and much much easier than some people think. So i would say: Give it a shot! Just follow the tutorials i linked to at the top of this page. installing xcode takes the most time i think (because its huge: 900 mb...)

 

2 notes about the compiling tut:

- when you do not see an option to enable unstable packages when running "/sw/bin/fink configure" then just go further. run all the commands until "/sw/bin/fink install ntfs-3g". after that one, please start again from "/sw/bin/fink configure". This time you should see the enable unstable packages option. after this you need to redo the following steps (of which you have done already a few).

- when you run into problems saying things about permissions you should try adding "sudo" before the command. So for example "/sw/bin/ntfs-3g /dev/disk2s1 /Volumes/ntfsdrive" becomes:

"sudo /sw/bin/ntfs-3g /dev/disk2s1 /Volumes/ntfsdrive"

 

Good luck! Let me know if you succeed or have problems.

 

Greetings Koen

Link to comment
Share on other sites

  • 3 weeks later...

i automount my drives by writing a applescript and save is as a application bundle and load it during login, but one thing i can't figure out is, my drive's mount point seem varies, exp. disk0s1 and disk1s1, they will swap ?! anyone knows how to fix this? thanks

Link to comment
Share on other sites

 Share

×
×
  • Create New...