LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices



Reply
 
Search this Thread
Old 07-12-2004, 04:10 PM   #1
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Rep: Reputation: 15
Backing up selected directory...


Hello, this is my first post!

I am running Suse Enterprise 8.1 and want to learn how to run an automated backup of selected directories every night. Isn't there some sort of software included for this? I figured there was something equivalent to Windows Backup or something. So far I have looked into the TAR command and cron jobs. Am I on the right track?

Thanks,
CRCool75
 
Old 07-12-2004, 05:24 PM   #2
Ztyx
Member
 
Registered: Dec 2001
Location: Stockholm, Sweden
Distribution: Ubuntu, Kubuntu and Debian
Posts: 338

Rep: Reputation: 30
Yes you are. cron is the perfect program in linux for running stuff periodically. tar is the program for putting several files together into one big file. Altough for backuping I guess you also would like to compress your tar-files (since tar only puts the files together). Compressing is usually done with the program gzip in GNU/Linux. How put your backup folders into a compressed file can most easily be shown by an example:
Code:
tar -c folder_one_to_backup folder_two_to_backup | gzip -c > my_backup_file.tar.gz
The line you would like to run periodically by cron can be added in the file /etc/crontab. Also you have the possibility to add a script or program which should run periodically in one of the /etc/cron.[hourly|daily|monthly|weekly] folders.

For info on how to edit the /etc/crontab file you can issue the man -a crontab to look at all (three) man pages which are about crontab (you close each man page by pressing 'q').

Good luck!

/Jens
 
Old 07-12-2004, 06:30 PM   #3
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks Ztyx! That was a fast response... I'm really starting to like this place, LOL. Back to my questions... What you said will help me greatly. All I want to do is copy or compress my /serv directory to the tape in my tape drive. Would the following command do the job for one time only?

tar -c /serv /dev/hdd | gzip -c > server_backup.tar.gz

I'm not super sure where the tape drive is located. Incase you have not noticed, I'm very, very new to Linux. If I'm not mistaken, the tape drive would be represented by a folder or file. Am I correct? I wish it was like "My Computer" in MS Windows, but it's not. Thanks again!

CRCool75
 
Old 07-12-2004, 11:03 PM   #4
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Tape drives are usually something like st0, but it depends on your specific model. Try something like:
tar zcf /dev/st0 /serv

To just back it up to a file in another location:
tar zcf /path/to/backup.tgz /serv

You might also consider using the dump command to do your backups. A quick search for backup on Freshmeat gives plenty of other options.
 
Old 07-13-2004, 12:40 AM   #5
tradewind
LQ Newbie
 
Registered: Jun 2004
Location: Hanoi, Vietnam
Distribution: RedHat
Posts: 20

Rep: Reputation: 0
Hi CRCool75,
Try to use Webmin at www.webmin.com
It's a GUI tool for Linux.
Hope this helps,
 
Old 07-13-2004, 02:02 AM   #6
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
I am obviously way off as for the format of the command because I am lost now. The following command is evidently incorrect:

tar -c /serv /dev/hdd | gzip -c > server_backup.tar.gz

My intention was to copy the directory of /serv to a compressed file on the tape drive.

Stickman,

I am not sure how my tape drive is listed. I looked under Yast2, and I saw it as /dev/hdd I think, not sure because I am not in front of the server. I'll check out that Freshmeat site. Do you have any recommendations for a free, GUI based backup utility?

Tradewind,

I access the server using Webmin and under "System" I have selected "File System Backup" to create a backup. It will not accept it by saying "Failed to create backup : Filesystems of type REISERFS cannot be backed up by this module". Is there another way of doing this?

Thanks for all your help guys (and gals if there are any).
 
Old 07-13-2004, 07:27 AM   #7
Ztyx
Member
 
Registered: Dec 2001
Location: Stockholm, Sweden
Distribution: Ubuntu, Kubuntu and Debian
Posts: 338

Rep: Reputation: 30
Quote:
Originally posted by CRCool75
I am obviously way off as for the format of the command because I am lost now. The following command is evidently incorrect:

tar -c /serv /dev/hdd | gzip -c > server_backup.tar.gz

My intention was to copy the directory of /serv to a compressed file on the tape drive.
Hi again CRCool75,
Doing the command above reads everything from the /derv folder and the file /dev/hdd. Everything that it reads is compressed and put in the file server_backup.tar.gz. Since I haven't worked with tape backups I don't knopw which device that is, however wether /dev/hdd is a tape or a CD-rom (hdd is usually second CD-ROM) doesn't matter - I don't think you'd like to backup the tape to the harddrive since you want the other way around.

After looking at this page:
http://www.sb.fsu.edu/~xray/Manuals/...l#_Toc40080658
I made a guess that you should do something like
Code:
tar -c /serv > /dev/st0
to backup the /serv folder to your tape drive.

/Jens
 
Old 07-13-2004, 11:49 AM   #8
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Quote:
Originally posted by CRCool75
Stickman,
I am not sure how my tape drive is listed. I looked under Yast2, and I saw it as /dev/hdd I think, not sure because I am not in front of the server. I'll check out that Freshmeat site. Do you have any recommendations for a free, GUI based backup utility?
The basic syntax for creating a backup (whether to a file or a tape) is the same. I wouldn't bother complicating the command with pipes (|) and redirects (>). The basic syntax with gzip compression is:
tar zcf /path/to/backup/file /first/directory /second/directory

The option are:
c - create tar file
z - use gzip compression
f - specify the backup location

For example, to backup /serv to a file in the /backup directory:
tar zcf /backup/today.tgz /serv

To backup the /serv directory to a device like a tape:
tar zcf /dev/st0 /serv

These are really basic examples. You probably need to do a little research on the specific model of your tape drive to see which device it uses then make the appropriate substitution in the command. Try looking at the output of dmesg to see if you recognize anything. If you backup to file, then you probably would want to insert the date into the filename so that you can keep multiples.
 
Old 07-13-2004, 03:46 PM   #9
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
Ok... I have tried multiple commands and one of them seemed to do something. It just started scrolling all the information down the console window and I could not tell if it was writing to the tape. The drive light just remained on, did not blink what so ever. It is a Seagate Travan 40 and it is the only tape drive in the system. I found a simple command to backup to the default tape drive:

tar -c /srv

That will back up the contents of the /srv directory directly to the default tape drive. It just started scrolling all the crap down the screen again. I believe it is the right crap because I can read some of the contents which are things in that directory. But the question is, is it going to tape?

The particular tape I am using is straight out of the box. It does not need to be formatted does it?

Last edited by CRCool75; 07-13-2004 at 03:53 PM.
 
Old 07-13-2004, 04:24 PM   #10
Ztyx
Member
 
Registered: Dec 2001
Location: Stockholm, Sweden
Distribution: Ubuntu, Kubuntu and Debian
Posts: 338

Rep: Reputation: 30
No, it is not writing to your tape. The command you do is writing everything to the screen. You have to add the '-f'-flag as stickman said. The -f flag is used to direct the output of the program to somewhere else than the screen.
 
Old 07-13-2004, 08:12 PM   #11
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
Ahhh... Ok, I will have to look into that tomorrow when I get back in.
 
Old 07-13-2004, 10:14 PM   #12
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
The following is what I type and the error message I receive now for some reason:

> tar -cf /dev/st0 /srv
tar: /dev/st0: Cannot open: No such device
tar: Error is not recoverable: exiting now

The tape is mounted!
 
Old 07-13-2004, 10:20 PM   #13
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
How do I know if the data gets put to tape? Is there a command to use that lists the contents of what is on the tape?
 
Old 07-13-2004, 10:21 PM   #14
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 64

Original Poster
Rep: Reputation: 15
I am just full of questions!
 
Old 07-13-2004, 10:57 PM   #15
tradewind
LQ Newbie
 
Registered: Jun 2004
Location: Hanoi, Vietnam
Distribution: RedHat
Posts: 20

Rep: Reputation: 0
Quote:
Originally posted by CRCool75
I am just full of questions!
Hi CRCCool75,
I've just done a full backup of my system. A SCSI tape is usually recognized as /dev/t0, use the following command to check: ls -l /dev/st*.
Then use the following command:
- If you want to backup a specific directory to tape: tar cpf /dev/st0 -C / your_directory (be careful when typing this command. There is a space between "-C" option and "/" and "your_directory", "-C /" tell tar to change to / directory before doing backup.)
- If you donot want to backup a directory, use the "--exclude=directory" option. For example, if you want to backup all of your system, use this command: tar cpf /dev/st0 -C / --exclude=proc . (the "." at the end of this command tells tar to backup all your systems)
- If you want to check whether the backup is OK: tar dvf /dev/st0
- If you want to list the contents of tape: tar tvf /dev/st0 and tar tvf /dev/st0 > filename.txt if you want to put the output to a file instead of screen.
- If you want to restore from tape: tar xvf /dev/st0
If you want to learn more, try this web: http://ftp.ucr.ac.cr/solrhe/chap29sec305.html
Hope this helps,
 
  


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
VI : Copying Selected Text Chaitanyayardi Linux - Software 1 11-10-2005 08:40 AM
backing up a directory to another hard drive aducarrab Linux - Newbie 1 01-29-2005 10:27 PM
AGAIN.. error.. basesystem not selected Remote Mandriva 5 04-15-2004 10:48 AM
Starting terminal from nautilus at selected directory ericwsf Linux - General 0 04-14-2004 05:15 PM
backing up directory to CD-RW drive? jermo5 Linux - Software 2 08-06-2003 04:09 PM


All times are GMT -5. The time now is 06:40 AM.

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