Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-07-2005, 11:03 AM   #1
Registered: Feb 2003
Location: Boston, MA
Distribution: RedHat 9
Posts: 39

Rep: Reputation: 15
Backup second drive to third drive


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 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!!!
Old 04-07-2005, 11:50 AM   #2
Senior Member
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
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:
0     0     *     *     *         dd if=/d/share of=/e/share
and then run
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
  workgroup = Workgroup
  netbios name = Hostname 
  server string = File Server
  encrypt passwords = yes
  hosts deny =
  hosts allow = 192.168.0. 127.
  security = share
  socket options = TCP_NODELAY
  guest account = nobody
  preferred master = yes

  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'

Last edited by phil.d.g; 04-07-2005 at 11:57 AM.
Old 04-07-2005, 11:58 AM   #3
Senior Member
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
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;

#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.
Old 04-07-2005, 12:22 PM   #4
Registered: Feb 2003
Location: Boston, MA
Distribution: RedHat 9
Posts: 39

Original Poster
Rep: Reputation: 15
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?
Old 04-07-2005, 12:39 PM   #5
Senior Member
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
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
Old 04-07-2005, 01:12 PM   #6
Registered: Feb 2003
Location: Boston, MA
Distribution: RedHat 9
Posts: 39

Original Poster
Rep: Reputation: 15
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?

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 !!


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
Hard drive/System backup ksgill Linux - Newbie 2 11-11-2004 02:10 AM
Hard Drive Backup Boffy Linux - Software 4 10-19-2004 01:38 PM
IDE to USB drive backup with dd ? IIcx Linux - Newbie 1 04-11-2004 08:59 AM
cannot backup to tape drive complus Linux - Newbie 5 10-01-2003 05:17 AM
Backup Boot drive question... Spec Linux - General 5 09-17-2002 09:56 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:17 AM.

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