Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-29-2012, 08:12 PM
|
#1
|
LQ Newbie
Registered: Nov 2007
Posts: 8
Rep:
|
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
|
|
|
03-29-2012, 08:40 PM
|
#2
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415
|
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.
|
|
|
03-30-2012, 02:03 PM
|
#3
|
LQ Newbie
Registered: Nov 2007
Posts: 8
Original Poster
Rep:
|
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 02:05 PM.
Reason: missing error checking bit of the mount code
|
|
|
04-02-2012, 09:57 PM
|
#4
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415
|
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.
|
04-03-2012, 09:11 AM
|
#5
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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.
|
All times are GMT -5. The time now is 12:04 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|