LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-29-2012, 07:12 PM   #1
mariogiov
LQ Newbie
 
Registered: Nov 2007
Posts: 8

Rep: Reputation: 0
Mounting multiple NFS or Samba shares: client-side or server-side?


Hi all,

I've got a LAN here with about 10 Win7 boxes (and soon 10 RedHat boxes), all of which regularly produce experimental data that I sync to a central RedHat server.

The way I'm doing this right now is to have the central server mount each of the shared folders from the Windows machines (mount.cifs) and then periodically check for files that are both new and haven't been modified for a few minutes (experiment is complete, data is done being written).

This works fine for the moment; however, I wonder if it's the best way to do this, especially as things scale up. Is there a big difference, for example, if each of the Windows shares mounts a Samba share from the Linux server and writes to it directly? That seems like a worse idea to me, but I don't know a great deal about how all this works at a low level.
Additionally, when I add the Linux boxes I was planning on using NFS to share files to the central server. Is it possibly a better idea to just deal in Samba -- maybe less work for the central server than dealing with NFS as well?
Are there other options I'm missing that might be better than either of these?


Thanks for your thoughts,

Mario
 
Old 03-29-2012, 07:40 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,232

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
I'd have the central server permanently mount the remote cifs & nfs disks from the other systems, but have the copy cmds check by trying to eg cd into those before trying to move data.
You can also add mount cmds to the copy scripts if original cd fails, so that they can re-mount without you.

Consider that when cxns disappear (& they will) you don't want experimental data lost because you can't write to a remote (central server) disk.
 
Old 03-30-2012, 01:03 PM   #3
mariogiov
LQ Newbie
 
Registered: Nov 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Hey Chris,

Yeah the way I have it set up at the moment is to have cron execute this every five minutes:

Code:
mount -a 2>/tmp/error.txt; if [ $? = 1 ]; then echo -en "\n\nERROR: `date`: " >> /home/server/Desktop/workstation_data/`date +%Y%m%d`_mount.err; cat /tmp/error.txt >> /home/server/Desktop/workstation_data/`date +%Y%m%d`_mount.err; fi

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

for FILE_PATH in `find /mnt/station*/Public/Documents/ -type f -ctime -3 -mmin +10 -print | grep -v "National Instruments"`; do
   FILE=$(echo $FILE_PATH | cut -d / -f 6)
   YEAR=$(echo $FILE | perl -lne 'if ( $_ =~ m/Expt_(\d{2})\d{2}\d{2}/ ) { print $1 }')
   MONTH=$(echo $FILE | perl -lne 'if ( $_ =~ m/Expt_\d{2}(\d{2})\d{2}/ ) { print $1 }')
   DAY=$(echo $FILE | perl -lne 'if ( $_ =~ m/Expt_\d{2}\d{2}(\d{2})/ ) { print $1 }')
   mkdir -p /home/server/Desktop/workstation_data/by_date/20$YEAR/$MONTH/$DAY
   echo -en "Syncing file:\t"; echo $FILE_PATH
   rsync -aPv $FILE_PATH /home/server/Desktop/workstation_data/by_date/20$YEAR/$MONTH/$DAY/$FILE 2>/tmp/error.txt
   if [ $? != 0 ]; then
      echo -en "\n\nERROR: `date`: " >> /home/server/Desktop/workstation_data/`date +%Y%m%d`_rsync.err
      cat /tmp/error.txt >> /home/server/Desktop/workstation_data/`date +%Y%m%d`_rsync.err
   fi
done

IFS=$SAVEIFS
(I added the -ctime -3 in case a workstation goes down over the weekend when I'm not here.) I'm considering that as I add more workstations this may get a little out of hand. You're right however that when the connection goes down it's imperative to have a local copy of the data on each workstation.

Any thoughts on using both NFS and CIFS? Really I suppose the bottlenecks will be network bandwidth and disk writes rather than CPU in any event, so perhaps this is a moot point.


Thanks again,

Mario

Last edited by mariogiov; 03-30-2012 at 01:05 PM. Reason: missing error checking bit of the mount code
 
Old 04-02-2012, 08:57 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,232

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
Well, for the Linux boxes, NFS, but try to use latest ie NFS v4 which uses TCP and is much more reliable.
For MS boxes, your choice ... Traditionally Samba / CIFS, but it can be fiddly, or you can add SFU (Services for Unix) which should give you nfs client sw.
More consistent for management purposes, in fact you could probably automate some of the setup; just have a list of wkstns and get the server to automatically create/export nfs shares.
If you go Samba, I'd avoid having CIFS+NFS shares on the same disks/mnts....

The RHEL manual here explains (HOWTO) NFS + CIFS pretty well http://www.linuxtopia.org/online_boo...ion/index.html
 
1 members found this post helpful.
Old 04-03-2012, 08:11 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,319

Rep: Reputation: 252Reputation: 252Reputation: 252
Besides mounting in any direction, one could also enable an SSH server on the central machine (most likely it's running already) and allow the 20 clients to transfer the file by scp by hostbased or passphraseless ssh-key authentication (while preventing them to log in via ssh).

If I get the problem right, you only want to push data from the 20 clients to the server.
 
1 members found this post helpful.
  


Reply

Tags
nfs, rsync, samba, server, sync


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to login multiple client pc on using via openvpn server from client side raja6525 Linux - Networking 1 11-24-2010 09:42 AM
Running a Samba & AD domain side-by-side DanW85 Linux - Server 0 12-09-2009 10:37 AM
can't get access to client-side network from server-side network through openvpn nass Linux - Server 1 11-02-2009 04:41 AM
client side NFS files? bobbens Linux - Networking 3 11-01-2004 02:52 AM
help with client side NFS-firewall setup and server side NIS-firewall setup niverson Linux - Networking 3 02-02-2004 08:52 AM


All times are GMT -5. The time now is 11:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration