Tuesday, December 23, 2008

Serving Windows files from Unix


For the past 10 years, I have had 2 separate eco-systems on my home network. One was a Unix net, the other a Windows net. Rarely did one mingle with the other. Life was easy, and no one complained.

But I had to go and mess it all up.

My development hardware of choice is no longer a server, no longer a desktop... but a 17" laptop.
I currently have it Triple booting Vista, Mac OSX (hacked), and Debian Linux.
Under Vista I run a few virtual OS's using VMWare... so I'm pretty much self sufficient on this one machine.


So I moved all my windows machines down into the server room (actually it's just a corner of the garage), and put FreeBSD on all of them.

Anyways...
I still wanted to serve up my Vista laptop with music & video, as well as my livingroom laptop & xbox.
I also store a heck of alot of data files from my various projects.... and would like to keep them all on a similar filesystem format.

I though about converting the whole thing (8 hard drives of data - approx 2TB) and running it off an unix NFS server. But as the xbox and living room media center don't play well with NFS, I decided to run a Samba server instead, keeping the data on the original NTFS partitions.

Here's how I set up the main file server (running FreeBSD)


// grabed the ntfs-3g package
//
# pkg_add -r ntfsprogs
# pkg_add -r fusefs-ntfs
//or instead of packages, ports could be used:
# cd /usr/ports/sysutils/ntfsprogs/ && make install clean
# cd /usr/ports/sysutils/fusefs-ntfs/ && make install clean

// make sure gets loaded at boot...
//
# add fusefs_enable="YES" to /etc/rc.conf.
# add fuse_load="YES" to /boot/loader.conf.

// fix freebsd's limited mounts
//
# mv /sbin/mount_ntfs /sbin/mount_ntfs.bak
# ln -s /usr/sbin/mount_ntfs-3g /sbin/mount_ntfs

// make the hosting directories
//
# mkdir /mnt/win/projects
# mkdir /mnt/win/resources
# mkdir /mnt/win/media
# mkdir /mnt/win/apps

// mount ntfs drives
//
# vi /etc/fstab
// add the ntfs drives...
/dev/ad2s1 /mnt/win/projects ntfs rw,late,uid=nobody,umask=000 0 0
/dev/ad3s1 /mnt/win/resources ntfs rw,late,uid=nobody,umask=000 0 0
/dev/ad4s1 /mnt/win/media ntfs rw,late,uid=nobody,umask=000 0 0
/dev/ad6s1 /mnt/win/apps ntfs rw,late,uid=nobody,umask=000 0 0


// create our symbolic links so that they are available to samba
//
mkdir /var/pub
# ln -s /mnt/win/projects/var/pub/projects
# ln -s /mnt/win/resources/var/pub/resources
# ln -s /mnt/win/media/var/pub/Media
# ln -s /mnt/win/apps/var/pub/Apps



-----------------
2) Install Samba
-----------------


// install filesystem driver
//
# pkg_add -r samba3
# vi /usr/samba/lib/smb.conf

// make sure it starts at runtime
//
# vi /usr/local/etc/rc.d/

// edit samba conf
// note: BATLOGIC is the name of my home network....
# vi /usr/local/etc/smb.conf
workgroup = BATLOGIC
server string = Pearl Samba Server
security = share
hosts allow = 192.168.1. 192.168.2. 127.

// add the share definition
//
[pub]
path = /pub
public = yes
writable = yes
printable = no



// start/restart the Samba service
# /usr/local/etc/rc.d/samba restart




everthing has been running smooth, and the Samba server is pretty responsive

0 comments: