Linux - GeneralThis 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.
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.
There is less than 12 hours left to vote in the 2015 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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!
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.
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!
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?!
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.
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.
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.