FreeBSD as fileserver for OS X and Windows network

Posted:
in Genius Bar edited January 2014
I've been wanting to build a file/backup server for a while and I finally go around to it. I had an old PC not being used so this last weekend I installed FreeBSD 5.4 on it, setup Samba, and started backing up my ibook over the network. Everything seems to work pretty well, except I want to make sure I'm not losing any data, metadata, timestamp info, etc.



Can anyone give me a little advice on the best network protocol to use for this... should I use NFS, CIFS, Samba, netatalk, or what???



Samba seems to strip the creation date from my files. Netatalk (afpd) seems to put lots of invisible .blahblah (ie: .AppleDouble) everywhere in my FreeBSD shares.



How about the filesystem format on the FreeBSD box. Is there some special format I can use to make sure it's totally compatible with the OS X file structures so that it will keep all the data in tact???



Thanks.
«1

Comments

  • Reply 1 of 25
    dobbydobby Posts: 797member
    Use Samba. Its easy to setup and allows unix/mac and pc to see it.



    Dobby.
  • Reply 2 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by dobby

    Use Samba. Its easy to setup and allows unix/mac and pc to see it.



    Dobby.




    I probably will end up using samba, but it's real annoying when I start copying a large directory and then it comes along a filename that is too long or has illegal characters in it and then the entire copy process quits.



    Also, does samba maintain all metadata, file structure, etc? or will I lose stuff from all the files, such as dates, types, etc???
  • Reply 3 of 25
    dobbydobby Posts: 797member
    Samba retains no metadata.



    I use Fedora machines as samba servers to PC's and Macs. To retain the metadata I do the following.



    Mount the nfsshare on a mac.

    Copy the data on the mac to the nfsshare.

    Export the nfsshare as a smb share as well.



    The smb share now has the metadata from the mac (only the mac can see it). I run a script to replace spaces at beginning of names and any funny escape sequences that PC's can't view. ("/") are not allowed etc.



    Dobby.
  • Reply 4 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by dobby

    Samba retains no metadata.



    I use Fedora machines as samba servers to PC's and Macs. To retain the metadata I do the following.



    Mount the nfsshare on a mac.

    Copy the data on the mac to the nfsshare.

    Export the nfsshare as a smb share as well.



    The smb share now has the metadata from the mac (only the mac can see it). I run a script to replace spaces at beginning of names and any funny escape sequences that PC's can't view. ("/") are not allowed etc.



    Dobby.




    So you are saying that NFS retains everything.?.? And then the SMB is only to allow my Windows machines to see the same share/data (minus the metadata which is seen only by the Mac)? Thanks for the info.
  • Reply 5 of 25
    fahlmanfahlman Posts: 740member
    I'm guessing here. Couldn't you use Darwin, and if you wanted a GUI install Fink and a port of Gnome or KDE?
  • Reply 6 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by fahlman

    I'm guessing here. Couldn't you use Darwin, and if you wanted a GUI install Fink and a port of Gnome or KDE?



    I would love to use Darwin, and actually downloaded the Darwin x86 iso, but thought I might have a hard time finding drivers for the NIC, SATA card, etc.



    Or am I wrong about that?? Can I use the same Drivers as I would in FreeBSD?
  • Reply 7 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by fahlman

    I'm guessing here. Couldn't you use Darwin, and if you wanted a GUI install Fink and a port of Gnome or KDE?



    PS: In the context of my project what advantage would I have using Darwin instead of FreeBSD? Either system, though they are very similar, would still use nfs, smb, or afp for file sharing. Would the advantage be that Darwin is already configured to format the drive in HFS+???
  • Reply 8 of 25
    fahlmanfahlman Posts: 740member
    The reason I suggested Darwin was because of its support of HFS+. As far as drivers I don't know. Maybe someone with more experience could add some input.
  • Reply 9 of 25
    fahlmanfahlman Posts: 740member
    You would basically have the guts of OS X minus the eye candy. For your purposes it would be just like backing up to a Mac on your network, I would think. You could use Apple File Sharing just like you were connection to any other Mac. Should be seamless.
  • Reply 10 of 25
    mikefmikef Posts: 698member
    Quote:

    Originally posted by dobby

    Samba retains no metadata.



    I use Fedora machines as samba servers to PC's and Macs. To retain the metadata I do the following.



    Mount the nfsshare on a mac.

    Copy the data on the mac to the nfsshare.

    Export the nfsshare as a smb share as well.



    The smb share now has the metadata from the mac (only the mac can see it). I run a script to replace spaces at beginning of names and any funny escape sequences that PC's can't view. ("/") are not allowed etc.





    Why does NFS retain metadata and SMB does not? How/where is the metadata stored?
  • Reply 11 of 25
    mikefmikef Posts: 698member
    Another option would be to backup to a DMG and then copy that to the server running whatever protocol you want.
  • Reply 12 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by mikef

    Another option would be to backup to a DMG and then copy that to the server running whatever protocol you want.



    Yea, that would maintain the data/file structure, but wouldn't really be practical for randomly accessing thousands of files or large movie or audio files.



    NFS sounds like a good way to go but GEEEEZ.. what a pain in the --- to configure. Anyone know of any good tutorials for configuring NFS server on FreeBSD and NFS client on OS X??
  • Reply 13 of 25
    mikefmikef Posts: 698member
    Quote:

    Originally posted by Macvault

    Yea, that would maintain the data/file structure, but wouldn't really be practical for randomly accessing thousands of files or large movie or audio files.



    No, but for archival storage, it'd be fine. I typically do not touch my backups unless they're needed, so not having them "live" isn't a big deal.



    Quote:

    NFS sounds like a good way to go but GEEEEZ.. what a pain in the --- to configure. Anyone know of any good tutorials for configuring NFS server on FreeBSD and NFS client on OS X??



    If the UIDs match between the client and server, there shouldn't be any major issues. Do you have specific problems?
  • Reply 14 of 25
    macvaultmacvault Posts: 323member
    Quote:

    Originally posted by mikef

    No, but for archival storage, it'd be fine. I typically do not touch my backups unless they're needed, so not having them "live" isn't a big deal.



    If the UIDs match between the client and server, there shouldn't be any major issues. Do you have specific problems?




    Yea, I guess it would work for archival. Could I write the DMG directly to the samba share without having to write it localy on my ibook, then transferring it to the share?



    As for the NFS problems.. I got it to where I could see (read) the share but didn't have previleges to write to it. Probably something simple. Would this be fixed in /etc/exports ?
  • Reply 15 of 25
    mikefmikef Posts: 698member
    Quote:

    Originally posted by Macvault

    Yea, I guess it would work for archival. Could I write the DMG directly to the samba share without having to write it localy on my ibook, then transferring it to the share?



    This should work fine. I was able to a test backup to a Samba share using Super Duper.



    Quote:

    As for the NFS problems.. I got it to where I could see (read) the share but didn't have previleges to write to it. Probably something simple. Would this be fixed in /etc/exports ?



    The UIDs have to match between the client and server.



    Use the 'id' command on OS X and the server to confirm your UIDs and adjust them in the /etc/passwd, and /etc/group files (if necessary) on the server.



    Also, obviously the share has to be exported from writing.



    What I typically do for NFS is create a group 'local' and then give local ownership/write permissions to the exported filesystem.



    For example (after adding the group 'local' and adding yourself to it):



    Code:




    $ mkdir /export/backup

    $ chown root:local /export/backup

    $ chmod 770 /export/backup









    Then export this filesystem (not sure how this is done on FreeBSD; it's been a while for FreeBSD for me) with 'rw' (read/write permissions)
  • Reply 16 of 25
    dobbydobby Posts: 797member
    Sorry guys, I left out that we use Helios (OPI app) on our MAC server. Helios changes the way resource forks are recorded so that when they are copied to an NFS share the resource fork is copied in a file format in a sub dir of the original.



    Dobby.



    Edit. I'll test a normal share. Note that I only use Solaris and Fedora. The closest thing I use to FreeBSD is OS X.
  • Reply 17 of 25
    mikefmikef Posts: 698member
    Ahh, that makes sense... I couldn't figure out why NFS properly handled the resource fork and SMB did not.
  • Reply 18 of 25
    macvaultmacvault Posts: 323member
    I just installed and mounted a Deskstar 250GB SATA drive in FreeBSD but after formatting it shows only about 202GB available. Is this normal? Doesn't seem like it should eat up that much.



    Is there some way I can format this drive in HFS+ so I don't get a ._ file for every (Mac OS X) file I copy over? This seems like a pain in the ass. Why can't one file on one system equal one file on another system!?!



    Anyone know if Darwin x86 would support the FreeBSD drivers for my NIC(no name) and SATA(Syba) card?
  • Reply 19 of 25
    mikefmikef Posts: 698member
    Quote:

    Originally posted by Macvault

    I just installed and mounted a Deskstar 250GB SATA drive in FreeBSD but after formatting it shows only about 202GB available. Is this normal? Doesn't seem like it should eat up that much.



    250,000,000 bytes == 244160.625 MB == 238.412 GB



    I am not sure about FreeBSD, but on Linux, 5% of that is reserved for the super-user so the total available would be 227.06MB. On Solaris, it's (64MB/partition size) * 100 (minimum 1% of drive space, maximum 10%). In this case, it would be 10% or total of 216GB.



    If the filesystem you formatted it as is journalled, there might be space preallocated for that as well.



    Quote:

    Is there some way I can format this drive in HFS+ so I don't get a ._ file for every (Mac OS X) file I copy over? This seems like a pain in the ass. Why can't one file on one system equal one file on another system!?!



    Even if you could format it using HFS+, it is a local filesystem, not a network filesystem. You'd need a network protocol that is aware of the resource/extended attribute information. Perhaps Appletalk? (again, I have no experience there)



    There is an article on one of the Mac sites (MacFixIt, maybe) about how to disable creating .DS_Store files.
  • Reply 20 of 25
    dobbydobby Posts: 797member
    Quote:

    Originally posted by Macvault

    Is there some way I can format this drive in HFS+ so I don't get a ._ file for every (Mac OS X) file I copy over?





    This is the resource fork data (or part of it).

    If you change the colour of the file on the mac then copy it to the nfs share then mount that share on another mac and copy the file there then the colour shouldbe restained.

    This doesn't work on SMB.



    Dobby.
Sign In or Register to comment.