NTFS+Linux+Samba=GibberishNTFS has come a long way on Linux in the last few years, there's even some read/write drivers that work, and generally, the dual-boot camp has seen so much development geared towards them that certain Linux install CD's even come with a bunch of .exe files on them, almost as if it's assumed you'll be running Windows® first. No comment.
So you can access you windows drives from Linux, great! .. if they are on the same box. But what about if you want to serve up those NTFS drives as shares, perhaps to.. GASP! a windows box? In this case, XP. Due to a series of circumstances outside the scope of this blog entry, I recently had to do exactly that.
Now, I pride myself on being able to do pretty much anything when it comes to Samba networking, after all, I've had a multi-platform LAN here for years, and every cross-platform network thing I've desired to do, has been done. But I have to admit, this one stuck me, which I guess is what I get for priding myself.
Mounting the NTFS drive is easy enough..
mount -t ntfs /dev/hdd1 /mnt/arc -o ro
plus whatever options rock your boat (I'm using the read-only driver for now). And then create a share in my smb.conf..
[arc] path = /mnt/arc comment = archive place admin users = cor deny hosts = 0.0.0.0/0 allow hosts = 192.168.1.
Or something like that, and away we go. The share appears on the network, check, mount it on the XP box, check. So far so good.
Everything looked fine to begin with. Although I did notice a lack of cute folder icons and silly background images, as are my wont. All the files and folders were there, sure, but something was definitely wrong.
I opened a random text file. Complete gibberish. Some applications refused to read any of the files, others would show contents which were clearly from other files, and some would do no more that spew out incoherent file system error messages in strange variants of unicode. Very curious.
I could access the files just fine on the Linux box, see the contents, listen to MP3's, whatever, so I knew there was no problem with the NTFS mounting process. Somewhere, somehow, Samba was messing them.
I tweaked loads of things, to the point of trying stuff that I knew full well would have no impact whatsoever, like..
csc policy = disable
force unknown acl user = yes
oplocks = no
locking = no
map acl inherit = yes
Clearly getting desperate, I decided to RTFM and loaded up the man page for smb.conf, not a small page. Running a firefox type-to-find (yes, I view man pages in my browser, thanks to man2html, and a nice Firefox search plugin I cooked up to access the man2html script on a local Linux server) I searched for "(s)", that is, directives that apply to only shares.
Eventually, of course, I found the golden command, and instantly, all my files are themselves again. *phew* It's simply this..
use sendfile = no
Pesky, huh! Well, hopefully I've peppered this blog with enough keywords to save some poor soul the heartache of scrolling the full length of the smb.conf man page.