LinuxQuestions.org
Help answer threads with 0 replies.
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 04-09-2007, 12:21 PM   #1
MoMule
Member
 
Registered: Jul 2006
Posts: 134

Rep: Reputation: 15
Set up rsync to mirror mount on Windows Server to mount point on 2nd internal drive


I am running Mandriva 2005 Mini.

I have an NT4 PDC's users folders mounted to /mnt/nt4
I also have a second hard drive in my server mounted as /var

I want to mirror everything in my NT4 mount to /var/archive/

What command would I run to have rsync do this for me? Am I using the right thing (rsync) since I want everything inside /var/archive to be exact (say up to 10 minutes) as everything located on the actual NT4 PDC?

Thanks,

Deion "Mule" Christopher
 
Old 04-09-2007, 04:26 PM   #2
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
First
Code:
 mkdir -p /var/archive
SEcond, make a file:
Code:
vi nt4-mirror.sh
Inside the nt4-mirror.sh, add this:

Code:
#!/bin/sh
#nt4-mirror.sh
#mirror /mnt/nt4 to /var/archive every 10 minutes from CRON

/usr/bin/rsync -azv /mnt/nt4/ /var/archive

Give it executable permission
Code:
chmod +x nt4-mirror.sh

put this file in the crontab to run every 10 minutes to mirror and sync up
Code:
crontab -e
In the crontab
Code:
10 * * * * /path/to/file/nt4-mirror.sh
EDIT: I may be wrong in my crontab to run every 10 minutes. It MIGHT be:
Code:
0,10,20,30,40,50 * * * * /path/to/file/nt4-mirror.sh
I'm sure some CRON guru can let you know.

BUT, I could be wrong.

Last edited by Micro420; 04-09-2007 at 06:01 PM.
 
Old 04-09-2007, 08:11 PM   #3
MoMule
Member
 
Registered: Jul 2006
Posts: 134

Original Poster
Rep: Reputation: 15
THANKS!

I have used rsync in the past, but was too chicken to try and set it up for fear of losing files on the NT4 server.

My next step is to match, on the Linux server, the users from the NT4 server. Should the NT4 server crash, I can have each workstation (user) map a drive to the Linux server and resume normal operations (access their personal files as well as shared directories).

This is all for a backup for _when_ the NT4 server crashes.

Any suggestions for setting this part up?

I am figuring that I will need to set up SAMBA, and somehow create new users on this Linux server to match the NT4 users, but probably don't need to set SAMBA up as a domain server though.

Thanks again,

Deion "Mule" Christopher
 
Old 04-09-2007, 08:31 PM   #4
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
if you are scared of what would happen, use this option:
Code:
rsync -avz --dry-run /mnt/nt4/ /var/archive
The --dry-run option will only do a simulation of what would happen. Then if it looks good, take out the --dry-run

yes, you will need to create a samba share in case your NT4 server crashes. Then you can map the users drive on the Mandriva system. Assuming Mandriva 2005 mini has SAMBA, all you need to do is configure /etc/samba/smb.conf (I'm assuming that's the correct path for Mandriva).

Are you using Active Directory on your NT4 box? There is a way to get SAMBA to be in your Active Directory, but I would have to consult my Samba book on how to do this. Wouldn't be a bad thing for me to finally learn how to do this. Otherwise, you would have recreate each user on the samba server which is a pain! So, in the interim of fixing your NT4 system, create a guest account or a dummy SAMBA user.

Here's an example of how I'm going to assume that the users need to access their files temporarily and you do not need security for the time being while you fix your NT4 server. The Linux box will act as a standalone samba file server

vi /etc/samba/smb.conf

Code:
# create a new entry for /etc/samba/smb.conf so Windows users can retrieve files from /var/archive

#this is the SHARE name Windows users need
[nt4] 

#So Windows users know what this drive is
comment = NT4 drive 

#path to where the NT4 files are on your Linux box
path = /var/archive

#means users can write to this directory.  Change to read only = yes if you only want them to read and not write
read only = no      

#users can see this on their network neighborhood
public = yes

#allow guests to connect.  Check your [global] section for what the guest account name is.  On my CentOS it is pcguest by default.  Make sure this new account is in the /etc/passwd
guest ok = yes
Now you just tell your Windows users to map to the new drive by right-clicking their MY COMPUTER. I personally like to do it via the command line:

Code:
net use z: \\ipaddress\nt4 /user:pcguest
Now their Z: drive will be the /var/archive

Last edited by Micro420; 04-09-2007 at 08:40 PM.
 
Old 04-13-2007, 10:34 PM   #5
MoMule
Member
 
Registered: Jul 2006
Posts: 134

Original Poster
Rep: Reputation: 15
Everything worked like a charm!

The only thing I did differently was to include the /dev/null 2>&1 at the end of the crontab command.

Thanks a lot for your help!

Deion "Mule" Christopher
 
  


Reply


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
set mount point of /dev/hda1 to windows/c etc... shikhar Suse/Novell 5 08-08-2006 01:41 AM
set mount point of /dev/hda1 to windows/c etc... shikhar LinuxQuestions.org Member Intro 2 08-07-2006 06:48 AM
-set mount point of /dev/hda1 to/windows /C spoonbender Linux - Newbie 3 08-07-2006 01:44 AM
Erase windows + mount the 2nd hard drive. Dan8080 Linux - Newbie 2 06-23-2006 12:46 AM


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

Main Menu
Advertisement
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