Home -- Tutorials -- Quickies -- Manual Pages -- Search -- Feedback -- About The Site -- Forum
Setting up the NTFS Driver
added 3.11.1999 -- written by UNKNOWN


Article Description: This tutorial outlines settings up the NTFS driver on FreeBSD 2.2.x. At time of writing, there were two versions available, one for 2.2.x and one for 3.x. You may be able to use these instructions for later versions, but I am not sure.
There are 2 versions of the driver, for FreeBSD 2.2.x and for 3.x.

These instructions are for FreeBSD 2.2.x only.

In order to install this driver you will need to re-build the kernel as some of the header files it uses are patched, although no changes are necessary to the configuration file. If you do not have the kernel sources installed, either run sysinstall or, do the following as root:


Also, the driver requires the file mntopts.h from the source archives. To extract it:


C /usr/src sbin/mount

Then, as root make a directory to unpack the ntfs driver archive file into:


Download the gzip'd tar file containing the driver source to /tmp/ntfs.

Unpack the archive:


The version number (0.12beta) may be different.
Now copy the source code to the correct location:


Next you need to patch the 3 system header files. Use the ``-l'' (lower case L) option which ignores white-space differences as I found that the use of TAB and SPACE was inconsistent between the original files and the diff files:


The patch commands will produce output similar to this if successful:

Hmm... Looks like a new-style context diff to me...

The text leading up to this was:
--------------------------
|*** ./sys/sys/vnode.h.orig Fri Jan 1 00:17:30 1999
|--- ./sys/sys/vnode.h Fri Jan 1 00:17:35 1999
--------------------------
Patching file vnode.h using Plan A...
Hunk done

In the unlikely event of one (or more) patches failing patch will tell you, but it always makes a copy of the original file with the same name and the ``.orig'' extension.
Now you can make the driver. It is necessary to add ``BINDIR=/usr/sbin'' as it is missing from the Makefile:


Then the lkm (loadable kernel module):


Finally you need to rebuild the kernel. If you are using the GENERIC kernel then make a copy of the GENERIC config file (this isn't strictly necessary, but this way the kernel name will change and it will make it easier to identify which kernel you are booting with). I tend to use descriptive names so GENERIC_NTFS seems appropriate:


OK, all done, but before booting with the new kernel you should identify the NTFS slice. The slice number will depend on the layout of your disk. For instance, if you have a FAT slice followed by the NTFS slice and your FreeBSD slice at the end then they will be numbered (replace "w" with "s" for SCSI disks):

FAT - wd0s1
NTFS - wd0s2
FreeBSD - wd0s3

If your NTFS and FreeBSD slices are the opposite way round and you installed NT before FreeBSD, which is the preferred method then the slice numbers will be the same but not in order:

FAT - wd0s1
FreeBSD - wd0s3
NTFS - wd0s2

You can look at /etc/fstab to confirm the FreeBSD slice number (and possibly the FAT if there is an entry).

One exception to all this is if the NTFS slice is a logical drive in an extended partition. Logical drives are numbered from 5 irrespective of the number of slices on the disk. My disk, for example, is laid out like this:

FAT - sd0s1
FreeBSD - sd0s3
Extended partition - sd0s2
NTFS - sd0s5

Note that the extended partition itself is assigned a slice, but it cannot be used, i.e. you can't mount it.

Having identified the NTFS slice you can add an entry to /etc/fstab. Note the option ``ro'', this means it is mouted read only (remember the driver is read-only). This entry will cause the NTFS slice to be mounted automatically at boot time. If you would prefer it not to be then change ``ro'' to ``ro,noauto'', note there is no space before or after the comma!. You will also need to make a mountpoint for it, /ntfs in this example, or if you want to use, say, /mnt then use that instead of /ntfs in the /etc/fstab file.

/dev/sd0s5 /ntfs ntfs ro 0 0

If you choose not to have the slice mounted at boot time then use the following (as root) to mount it:

changing the device and mountpoint to suit your system.

That's it!. All that remains is to reboot. If the partition is mounted at boot time you will see some diagnostic messages, these are harmless:


ntfs_init():
ntfs_mountfs(): bps: 512, spc: 1, media: f8, mftrecsz: 2 (2 sects)
ntfs_mountfs(): mftcn: 0x315e5|0x287245
ntfs_mountfs(): case-sens., uid: 0, gid: 0, mode: 777
ntfs_iget: read $MFT ntnode
ntfs_mountfs(): reading $UpCase....OK

Enjoy!
© Copyright 1998-2008 VANGEYN.Net, unless otherwise noted.