LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-27-2003, 02:21 PM   #1
WorldBuilder
Member
 
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Rep: Reputation: 30
Weekly tape backup


Hi all,

I am fairly new to the UNIX world in general. I have a server machine running Red Hat 8.0 Professional. Several weeks ago, I had a catastrophic problem, and had to rebuild the entire machine. At the time, I had a SUN DLT 4000 tape backup unit hooked up to it via an Adaptec 2940 SCSI card. Prior to that failure, I had never taken the time to LEARN how to backup the system, and therefore, I did not have a backup. My server is rebuilt now, and my number 1 priority is to get it backed up on a weekly basis. I want to back up EVERYTHING on the system onto 1 tape(40GB capacity tapes). However, like I said, I don't know anything about backing up right now, but I need to get it working. A friend of mine told me that there is a simple "tar" command I can use that will backup every single thing onto the tape. Can someone please explain to me what this might be? I am a newbie to this, and I intend on truly learning about backups soon, but I need to get it working before I learn. What I want to do is set the server to backup automatically, every Sunday night at midnight. I want it to do a full backup, and rewind to the beginning of the tape when it is done, that way, the next week's backup will overwrite it. Can anyone explain this to me step-by-step. You'd be a lifesaver!!! Thanks a million!

Chris B.
 
Old 03-27-2003, 02:48 PM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
There are several ways to go about backups in Linux. I would suggest you check out the 'dump' command because it is the most widely used. I believe dump only supports ext2 file systems so if your using another file systems I don't think this would be an option.

Also you could simply create a cron job that backs up your system.

Here is a nice little tutorial to help you get started. Do a bit of googling for more information on backup options in Linux.
 
Old 03-27-2003, 02:56 PM   #3
WorldBuilder
Member
 
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Original Poster
Rep: Reputation: 30
Thanks

Thanks for the info. I'll definitely look it over. I'm using the ext3 filesystem, so I don't think dump will work, either. Like I said, I'd like to get this working soon, using tar(if that's the easiest). I can learn about it all later. Ugh, I'm busy... What would be the command for the cron job you mentioned? Thanks, man!

Chris

PS. Let's say I do start getting a successful weekly backup, and my server does indeed, fail. Can't boot, can't do anything. How do I restore, then?!
 
Old 03-28-2003, 06:55 AM   #4
Paul Johnson
LQ Newbie
 
Registered: Mar 2003
Location: Chelmsford, Essex, UK.
Distribution: Red Hat
Posts: 15

Rep: Reputation: 0
Dump will work fine with ext3. (ext3 is actually just ext2 with a journalling file tacked on and different drivers).

To use tar to make a tape backup:

First identify your tape device. Its probably /dev/st0. You can find out by putting a tape in the drive and saying

mt rewind /dev/st0

If that starts the tape spinning then you have the right device. I'd suggest making a symbolic link

ln -s /dev/st0 /dev/tape

So from now on you just use /dev/tape in your scripts.

To back up everything just say

tar cvf /dev/tape /

Note that this will also back up any mounted file systems (including CD, floppy and NFS mounts). It will also list every file it backs up. To avoid this use "cf" instead of "cvf".

You can also do compression in tar by saying "cvfz" instead of "cvf". This uses gzip and is pretty CPU intensive. DAT drives generally have hardware compression, so you don't need to do it yourself.

To recover your data say

tar xvf /dev/tape

If you have lost everything then re-install a basic Linux from the distro, and then use that to run tar. If you want to be really clever then you could make a bootable floppy with just a minimal kernel, fdisk, mke2fs and tar on it. But its probably not worth the trouble.

Paul.
 
Old 03-28-2003, 09:09 AM   #5
tracer
LQ Newbie
 
Registered: May 2002
Posts: 17

Rep: Reputation: 0
and how would you setup the cron job to run weekly?

Here is my situation...I have a 8 gig data drive I am backing up to a 20 gig tape. I want to (all on the same tape)

MONDAY - Backup 1
WEDNESDAY - BACKUP 2
SATURDAY - BACKUP 3

MONDAY2 - Overwrite Backup1
WEDNESDAY - Overwrite backup 2
SATURDAY - Overwrite Backup 3

where backup 1 , 2, 3 are directorys or parts of the tape. So on a single tape I always have the three most recent backups...(without having to change tapes...the box is rather inaccesible)
 
Old 03-28-2003, 09:37 AM   #6
Paul Johnson
LQ Newbie
 
Registered: Mar 2003
Location: Chelmsford, Essex, UK.
Distribution: Red Hat
Posts: 15

Rep: Reputation: 0
Ooof. Thats tricky. Tapes were never designed to be used that way. Its also a bad idea. Tapes are not useful backups when left in the machine. The whole point of tapes is that you can take them out of the machine and put them either in a fire safe or out of the building. If you leave the tape in permanently then you are only protected against a hard drive failure.

In fact I suspect you will find the cheapest way of meeting your requirements is to buy another hard drive. A 20 GB hard drive (tape sizes are doubled to allow for an assumed compression factor) will give you the same capability and actually cost less than a new tape. It will also be faster, more reliable, and easier to use. Just replace /dev/tape in my examples above with the file you want to (over)write.

To make something happen daily put a script in the /etc/cron.weekly directory. In this case you want the script to look at the day of the week and make the appropriate backup.

I'm not sure of a robust way of having 3 files spread out over a tape and then overwrite one at a time. The mt command allows you to skip to file start markers, so in theory you could create 3 12GB files initially. Use the following command:

dd if=/dev/zero of=/dev/tape bs=1024 count=12000

and then use some combination of mt commands to move around the tape. But I'm not at all sure that such a kludge could be made to work reliably. If you just want to protect against another HD failure then I recommend another drive.
 
Old 03-28-2003, 09:41 AM   #7
Paul Johnson
LQ Newbie
 
Registered: Mar 2003
Location: Chelmsford, Essex, UK.
Distribution: Red Hat
Posts: 15

Rep: Reputation: 0
Almost forgot to mention: each tape device has two names in /dev. In your case it will probably be /dev/st0 and /dev/nst0. The second form stands for "no-rewind".

If you use the first one then the tape will automatically rewind after every operation (so you use mt fsf 3 to skip three files forwards, and then it rewinds again).

Normally the auto-rewind alias is the one that you want. But if you are doing something complicated with multiple files on a tape then you want the no-rewind alias.

Paul.
 
Old 03-30-2003, 10:16 AM   #8
ravenswood1000
LQ Newbie
 
Registered: Mar 2003
Distribution: Redhat
Posts: 6

Rep: Reputation: 0
Amanda

Has anyone had sucess with Amanda for client/server backups?
 
Old 03-30-2003, 04:54 PM   #9
Paul Johnson
LQ Newbie
 
Registered: Mar 2003
Location: Chelmsford, Essex, UK.
Distribution: Red Hat
Posts: 15

Rep: Reputation: 0
> Has anyone had sucess with Amanda for client/server backups?

Yes, me. For the most part it worked very well, although it had an odd failure mode in which the backup happened at a few bytes per second. Never did get to the bottom of that.

There are some other niggles, most of which have to do with the limitations of the underlying programs (e.g. smbtar doesn't do exclusion lists). But overall I'd recommend it.

Paul.
 
Old 03-30-2003, 06:20 PM   #10
orange400
Member
 
Registered: Mar 2003
Location: Bellevue, WA
Distribution: Arch w/ XFCE
Posts: 834

Rep: Reputation: 30
I'm kinda curious about tapes ... are they sensitive to destruction? How fast do they backup?
 
Old 03-30-2003, 06:39 PM   #11
ravenswood1000
LQ Newbie
 
Registered: Mar 2003
Distribution: Redhat
Posts: 6

Rep: Reputation: 0
I'm currently backing up about 2 gigs on tape a day and it takes about a half an hour to backup and verify. I don't know much about tape longevity though as we just recently started backing things up. I'm hoping that we can rotate tapes once a month.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tape backup how to x2000koh Linux - General 4 01-25-2010 03:04 AM
Tape backup cbarbry Linux - Newbie 2 07-14-2004 06:07 AM
Tape incremental backup to different tape tungaw2001 Linux - Software 0 08-13-2003 10:42 PM
Doin a weekly tape backup - multiple questions - VERY important - Please help WorldBuilder Linux - General 10 04-25-2003 04:12 PM
Which Tape backup? biggiefatts Linux - Hardware 4 02-19-2003 04:21 PM


All times are GMT -5. The time now is 03:14 AM.

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