# Auto-Mount NTFS in the start of FreeBSD



## rokpa92 (Feb 19, 2010)

hi people.
some people know me because i very new and ask a lot in the forums (sorry) jeje =)

i have a problem for Auto-mount an NTFS hard disk in the start of freebsd. now, with the help of some people, i can make the "auto-mount".

here it's the steps (it's for any one need)

first, you need to know the disk, the partition and the slide NTFS you want to mount.
i my case, i have 2 hard drive. Primary for Windows 7 and FreeBSD, and the Second it's an entered partition NTFS for documents, pictures, work, music, and some videos.
so..
*MY* second hard drive, with an integer partition it's call *ad11s1* (i call this unit "Data")
If you have more hard drive, or only one hard drive, with 2 or more partition, you must know "how name (disk and slide) have your partition" (it's can be *ad10s1* or *ad10s2* or *ad10s6*, you must know in what hard drive and slide it's you NTFS partition)
now, in this "how to" i use my integer second hard disk (one partition with NTFS)

First, we need have *FUSEFS-NTFS*.
Whe can use the package (in root mode of course) do a simple:
`# pkg_add -r fusefs-ntfs`
or if you want install from ports do:
`# cd /usr/ports/sysutils/fusefs-ntfs/ && make install clean`

them, we need add this to rc.conf for start when the system it's loding. so:
`# ee /etc/rc.conf`
and, add the next line:

```
fuse_enable="YES"
```
and remmember you must have the line to:

```
dbus_enable="YES"
hald_enable="YES"
```
that make, fusefs enable when the system start.
you need save the file.
When the file it's saved, please start fusefs for first time with the command:
`# /usr/local/etc/rc.d/fusefs start`


second, we make the directory where we want mount the partition, in my case, i want the partition NTFS in the directory /media/Data
so.. we must create that directory:
in root mode do:
`# mkdir /media/Data`
now, with the directory maked, we need enable vfs.usermount
`# sysctl -w vfs.usermount=1`
now, we need go to /etc/fstab
`# ee /etc/fstab`
and add the next line

```
/dev/ad11s1  /media/Data  ntfs  rw,late  0 0
```
but be careful! MY partition NFTS it's *ad11s1*, you need put *your* partition here.

now, need to do a "symlinked".
for this do:
`# mv /sbin/mount_ntfs /sbin/mount_ntfs.orig`

`# ln -s /usr/local/bin/ntfs-3g /sbin/mount_ntfs`



			
				DutchDaemon said:
			
		

> Note: this may end up being overwritten by a [cmd=]make installworld[/cmd] or [cmd=]freebsd-update[/cmd] when you upgrade your system.



With the first command you rename the original mount_ntfs executable in the /sbin directory with the name mount_ntfs.orig, and with the second command you create a symbolic link (something like, but not at all, shortcut in windows parlance) of ntfs-3g in the /sbin directory, but with the name mount_ntfs, which is what fstab recognizes.

and now... we can mount!
do a:
`# mount /media/Data`
(here it's the directory where you want the NTFS mount and specify in the start of second step)

so, if you do all right, when you reboot FreeBSD, the partition NTFS it's mount in every start in that directory.

This guide it's make in base of this post: POST
thanks for the help for:

SirDice  
Beastie
phoenix
sixtydoses
mamalos
DutchDaemon
thanks every want for help me, and help all who need do this.
and thanks you, for reading this post 

*Have a nice day.*


----------



## DutchDaemon (Feb 19, 2010)

> ```
> # mv [B]/sbin/mount_ntfs[/B] /sbin/mount_ntfs.orig
> # ln -s /usr/local/bin/ntfs-3g [B]/sbin/mount_ntfs[/B]
> ```



Note: this may end up being overwritten by a [cmd=]make installworld[/cmd] or [cmd=]freebsd-update[/cmd] when you upgrade your system.


----------



## rokpa92 (Feb 19, 2010)

DutchDaemon said:
			
		

> Note: this may end up being overwritten by a [cmd=]make installworld[/cmd] or [cmd=]freebsd-update[/cmd] when you upgrade your system.



yes, i have have upgrade my system, but i don0t know that it's only for "upgrade" system. thanks for the tips


----------



## mamalos (Feb 19, 2010)

DutchDaemon has a point there, so I'll write his words in a way that they will suit your howto.

In order not to have problems once you upgrade your system with make buildworld, etc., one can do:

`# ln -s /usr/local/bin/ntfs-3g /sbin/mount_ntfs-3g`

instead of symlinking /usr/local/bin/ntfs-3g to /sbin/mount_ntfs.

Then, the correct fstab should have the line:


```
/dev/ad11s1  /media/Data  ntfs-3g  rw,late  0 0
```

This way, the binary /sbin/mount_ntfs-3g will remain in its place after an upgrade. (I don't know, maybe mergemaster will complain that a binary /sbin/mount_ntfs-3g exists and that it does not exist in the "new installation tree", so it may ask you if you wish to delete it, but you will reply "no" to that question).

Good point DutchDaemon and SirDice.


----------



## sixtydoses (Feb 19, 2010)

Add the following to /etc/sysctl.conf to make it permanent.


```
vfs.usermount=1
```


----------



## DutchDaemon (Feb 19, 2010)

@mamalos

mergemaster only concerns itself with /etc.


----------



## eayesta (Feb 26, 2010)

I'm not sure the proposed line in /etc/fstab should work. This is because ntfs-3g doesn't have the option 'rw', so it would give an error. I think a better way to accomplish this is:


```
/dev/ad11s1 /media/Data ntfs rw,mountprog=/usr/local/bin/ntfs-3g,late 0 0
```

At least this is what I use and works correctly


----------



## DutchDaemon (Feb 26, 2010)

That point was addressed here, more or less a split-off/continuation of this topic.


----------



## Juanitou (Mar 2, 2013)

There is an error, the rc.conf must be:

```
fusefs_enable="YES"
```

Well, at least that is how it works here with FreeBSD 9.1.

Hope it helps.


----------

