LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backup second drive to third drive (https://www.linuxquestions.org/questions/linux-newbie-8/backup-second-drive-to-third-drive-310748/)

joshnya 04-07-2005 11:03 AM

Backup second drive to third drive
 
Hello,

First off, please ask additional questions if I'm not clear describing......

Say I have a linux RH 8.0 box with (1) primary hard-drive running the OS.

I have (2) additional physical hard-drives as data drives(60GB each), both have been ripped out of a windows 98 box but just contain directories and files (no OS) and are formated as FAT32. (about 15GB of random data)

The idea I have is to SAMBA share the 2nd physical drive so my Windows LAN can use it as an all access peer-to-peer share drive while once per day I take the data from that drive and copy it to the 3rd physical drive an use it as a backup. I know that's not the best way of backing up but I'm more looking for a second copy of the data.

First Q: What will (should) the [share] paragraph in the smb.conf file look like for sharing out the file sharing drive?

Second Q: How do I copy *.* from one drive to the next. Meaning what could the command look like. I'd only like to write the new files but overwriting the existing files is okay too. ie) in DOS the command would look like..
cd D:
cd \share
XCOPY *.* E:\share\*.* /E /S /Y /R

Third Q: How do I schedule this once per day? Windows has a scheduler...does Linux?

Final Q: Is RH the best distro for a newbie to be doing this with? I'm open to any other distro...my main goal is to remove my dependancy on all the Windows BS and mirgate and learn about the beauty of Linux. I'm not terrably dependtand on GUI screens but it would be nice...I'm comfortable with the command line stuff but only on a VERY basic level.

Thanks everyone.....much appreciated!!!

phil.d.g 04-07-2005 11:50 AM

dd if=/dev/hdb of=/dev/hdc ought to do it assuming your second hdd is the primary slave and your third harddrive is your secondary master. To schedule make a cron file eg cronjobs and add an entry similar to this:
Code:

0    0    *    *    *        dd if=/d/share of=/e/share
and then run
Code:

crontab cronjobs
That schedule will run the backup everyday at midnight see here for information on how to edit your cron file. Assuming you mount those two drives as /e and /d

The best distro is what you feel most comfortable with, my advice to you as read the webpages of as many distros as you can and don't use redhat as it no longer maintains its free version and its last release was a long time ago, the successor to the redhat free version is fedora core

Your smb.conf file may look something like this
Code:


[global]
  workgroup = Workgroup
  netbios name = Hostname
  server string = File Server
  encrypt passwords = yes
  hosts deny = 192.168.0.1
  hosts allow = 192.168.0. 127.
  security = share
  socket options = TCP_NODELAY
  guest account = nobody
  preferred master = yes

[public]
  path = /d/share
  browseable = yes
  public = no
  hide dot files = yes
  read only = no
  guest ok = yes
  comment = public directory

remember to set your hostname and workgroup appropriately and the directory needds to be either world writable or owned by 'nobody'

TigerOC 04-07-2005 11:58 AM

Use rsync. Here is a sample script showing how I backup my /home to a spare drive on an hourly basis and I will explain below;

#!/bin/bash
#mount /dev/hda6 on /mnt
mount -t ext3 /dev/hda6 /mnt
#backup files to hda6
rsync --delete-after -avH /home/ /mnt/backup/home > /var/log/backup.log
#unmount hda6
umount /dev/hda6

To make it executable do chmod 700 ./backup

to run it do ./backup

I put it in /etc/cron.hourly

The following entry was put in /etc/crontab so that a backup is made 10 min past each hour.

# m h dom mon dow user command
10 * * * * root /etc/cron.hourly/backup

There are a lot of comments in the script which are self explanatory. You would need to install rsync. The explanation of the rsync line above is

sync the directories /home/ with /mnt/backup/home and delete all the files on the backup that are no longer on the source directory and maintain the links of the files and then write what you did to a log file. I have since changed the structure of the script and have /dev/hda6 permanently mounted now so I no longer mount or unmount the partition. The cron (scheduler) entry is for an hourly backup.
Hope this gives you some ideas.

joshnya 04-07-2005 12:22 PM

Thanks for the answers you two !! That's terrific !!

phil---You mentioned mounting the drives as "d" and "e".... drive letters????

Can that be done automatically upon startup? Meaning, Get fedora core instaled, shut down, pug in the 2 additional drives boot up and have all my data on those drives ready to be accessed....assuming smb is configured?

phil.d.g 04-07-2005 12:39 PM

no I mean you might have folders on you root filesystem named e and d just to make it clear which your referring to, once you have setup you system you don't need to try and remember if /dev/hdc is drive e on windows (for example) as it has been mounted to the folder e, maybe naming them win_e and win_d is a bit more clear, sorry for the confusion.

To have them mount at system startyp add an entry to your fstab along the lines of:

/dev/hdc /win_e auto defaults 0 0

joshnya 04-07-2005 01:12 PM

Both disk drives have the same root label so when I write my cron job would it look like this?

dd if=/dev/hdb/share of==/dev/hdc/share

could I start from the root like this ?

dd if=/dev/hdb of==/dev/hdc


Also, in the smb.conf file can the path be like this?

[public]
path = /dev/hdb/share


finally in the fstab can the auto boot line look like this?

/dev/hdc auto defaults 0 0


Thanks a milion again !!


All times are GMT -5. The time now is 02:18 AM.