Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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').
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!
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).
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.
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.
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?
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.
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,
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.