LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backup strategy (http://www.linuxquestions.org/questions/linux-newbie-8/backup-strategy-615783/)

philwynk 01-23-2008 12:15 PM

Backup strategy
 
Hi,

I need some help in backup/restore planning, and also in upgrade/software installation discipline.

I've just finished reinstalling my Fedora OS for the fourth time in two months.

The problem is that about 1/5 of the time when I try to install some software package to enhance the operation of the environment -- say, play movies -- I wind up damaging some critical part of the OS. When I try to recover from my backup, it doesn't work. Typically, the X-windows install gets screwed up and the graphical environment won't boot, and since I don't know how to fix it, I end up having to reinstall the OS.

The same thing happened when I downloaded a bunch of package updates through pirut; they damaged the system so badly I had to restore from scratch. Restoring the files I backed up just screwed things up worse. X-windows broke.

Would somebody who's familiar with the operation of a Linux host tell me what files I should back up in order to be able to recover from a download disaster? My current strategy -- which is clearly insufficient -- backs up /etc, /var/www (my web site), anything that has "lib" in the directory name, /usr/local/bin for my own written stuff. About once a month I do a big-ass backup that includes /usr/bin, /usr/sbin, /sbin as well.

I'd appreciate some comments about a patch strategy as well: what update packages should I download, when, and why?

Thank you in advance for your time.

An editorial comment: From a usability standpoint, this is madness. I never thought I'd be wishing for my Windows XP back, but the truth is the truth -- Microsoft is a pirate and a curse, but Windows is orders of magnitude more stable and friendly for desktop use than Linux. UNIX is a fine backend OS, great for network services, mainframe applications, file services, and other professional operations, but as a desktop environment, I could hardly be less satisfied. Maybe I'll try the Mac next (and yes, I know it's a UNIX implementation.)

Phil W.

ilikejam 01-23-2008 02:30 PM

Hi.

For ad-hoc backups, rsync is king. If you have enough space on an extra/external drive, you can copy the whole system, then do incremental updates as you see fit (better yet, RAID 1 the disks, and split the mirrors before you do any upgrades, but that's probably overkill).
Personally, I only back up /home, /etc and /var . Compiled-from-source stuff sits in /home/build , so it's just a matter of doing 'make install' from there to restore the /usr/local stuff, and everything else is from the distro packages, so can be 'restored' from yum.

I think your main issue is the way you're doing package installs, though. Can you elaborate? Are you doing something a bit funky with extra repositories etc?

Dave

tuxrules 01-23-2008 02:50 PM

What repos do you use for software installation? I only use livna with the official repos of Fedora and I've had occasional bad updates but they don't break the system...usually get fixed when I update a few days later.

I personally use a dar,gzip based backup script that backs up /etc, /home, /var/log, /var/www and /boot directories. The script puts backups in separate directories under /var/backups like...backup.0 backup.1 etc. The script only keeps 4 directories there so I save up on space as well. /var/backups is then rsynced every week to my portable hard drive. My data drive is directly rsynced to the portable hard drive.

And really I only need those in order to be back on my feet after a crash or reinstall. I never backup bin sbin or lib directories and never had a problem.

Quote:

Originally Posted by philwynk (Post 3032797)
Hi,
I'd appreciate some comments about a patch strategy as well: what update packages should I download, when, and why?

I suppose downloading official updates should always be encouraged. If you are making your own rpm's you got to watch out for changelogs, dependencies and newly introduced bugs.

philwynk 01-23-2008 04:26 PM

Well, I had no idea what I was doing with repositories, but I think I managed to add livna and a few others, and eventually something called gstreamer.

The system (Fedora Core 7 at the time) was configured to check for package updates automatically. I'd get a balloon from the pirut icon at the top of the screen telling me updates were available. I'd download whatever it found. There were a couple of times when a download would break some function temporarily (mplayer would stop working, for example), but then I'd reboot, and everything would sync up and work again.

I ran into real trouble the day I logged in as "root" instead of myself, and got the root desktop for the first time. The pirut icon told me there were 700+ updates. I thought "?", then "what the hell, I don't need the machine for a while," and downloaded them all. The next time I logged in as me, the pirut icon informed me that updates couldn't be checked 'cause there was no network connection. My network connection was working fine, but pirut couldn't find it for some reason. I figured it was because of the root download. I logged in as root again, same thing with pirut -- no network connection available. I rebooted. When the machine came up, pirut was running again, and told me I had updates. I accepted them, rebooted, and... BLAM. X-windows was broken. I tried to restore -- copied /var and /etc from a backup -- but X wouldn't come back, and I couldn't even boot after that. I had to restore from the Fedora 7 DVD. Lost a bunch of content. Bleh.

My latest flub occurred last night. In trying to find an mplayer plug-in, I downloaded some package in which the README said it needed XFree86 libraries. I went and found them and downloaded before I realized that the package was attempting to replace my entire X11 install; I should have just finished the job, but I stopped at that point. Next time I rebooted, X was gone and I had a blank screen.

Now I'm realizing what happened, and I know a bit more. I've got a bunch of repositories configured (from Fedora-faq): fedora, livna, rpmforge, planetccrma, kde-redhat, jpackage, adobe-linux-386, freshrpms, atrpms. I've got plugin priorities enabled to check for obsoletes. What else do I need?

I've not been updating packages, though. Seems dangerous. Should I? And, what do you suppose happened that time I was logged in as root?

complich8 01-23-2008 04:43 PM

Personally, I only use the official and one add-on repository for my fedora and/or redhat installs, and updating is generally fairly safe. Having too many, you might end up with mismatched update versions and stuff that just doesn't play nicely together.

It sounds like you don't really know what a lot of stuff is, and that's causing you to do things you don't need to do. For example, gstreamer is a multimedia framework/backend that a lot of gnome apps use.

Unfortunately, short of googling what everything is and trying to get a good idea how it all interacts, there's not a whole lot anyone can do to prevent that. It's all part of the learning curve ...

My recommendation is: back up the config files you modify in /etc, back up your htdocs directory, and back up your home directory. Make sure that your homedir in particular lives on a different partition, if it currently doesn't.

Restoring from backups isn't so much about waving a wand and having your system come up. It's about waving a wand and having your data back after you get your system running again -- preventing data loss. To that end, I don't recommend backing up things like /usr/lib or /usr/bin. Restoring a lib without the corresponding bin, or vice versa, is likely to make things more broken after a bad update due to mismatched interface versions and linking issues.

If you want to have the "have the system back" thing, I recommend you look into Clonezilla or SystemRescueCD. Periodically image the system partition onto an external source (eg: a usb2 disk) and when stuff fails, you can just shove the old image back on the partition.

ilikejam 01-23-2008 04:48 PM

Ah. All becomes clear.

Stick to one-and-only-one extra repository. Mixing repositories in known to break things in new and spectacular ways.
External repos are very much Not Supported, but having a single extra one is largely not a problem. Livna has a good reputation, so if I were you, I'd remove all but that one and the official Fedora ones, and you should be good to go.

Dave

tuxrules 01-23-2008 05:59 PM

Quote:

Originally Posted by philwynk (Post 3033052)
My latest flub occurred last night. In trying to find an mplayer plug-in, I downloaded some package in which the README said it needed XFree86 libraries. I went and found them and downloaded before I realized that the package was attempting to replace my entire X11 install; I should have just finished the job, but I stopped at that point. Next time I rebooted, X was gone and I had a blank screen.

XFree86 is the previous generation of Xorg. You tried to install mplayerplug-in and in doing so tried to replace Xorg...that's a monumental task by any standards. You can easily get mplayerplug-in from livna. Also, please don't run as root. This is dangerous and has been amply documented on this site.

Another tip (may be not a tip afterall), try to use the command-line yum. I tend to trust it more than some gui slapped on top of it. Updating is as simple as :

1. logging in as root in the terminal (or better yet use sudo)
2. yum update (yum -y update for unattended updates)
3. man yum for more info

Here's a pretty good link on how to install...
http://www.mjmwired.net/resources/mjm-fedora-f8.html

philwynk 01-23-2008 08:11 PM

Ilikejame writes:

Quote:

Stick to one-and-only-one extra repository. Mixing repositories in known to break things in new and spectacular ways.
External repos are very much Not Supported, but having a single extra one is largely not a problem.
And complich8 writes:

Quote:

Personally, I only use the official and one add-on repository for my fedora and/or redhat installs, and updating is generally fairly safe.
Interesting. And not surprising. Might I suggest that BOTH of you fine gentlemen (or ladies, if ye be of that gender) write to the fellow who wrote the Unofficial Fedora FAQ, and who provides a list of repositories that he recommends for Fedora installs? Note what he says in item #6:

Quote:

Now, install my yum configuration (Updated 12 Nov 2007), using this command:

rpm -Uvh http://www.fedorafaq.org/f8/yum http://rpm.livna.org/livna-release-8.rpm
The list of repositories that fedorafaq.org link creates is long and creative. I will pare the list extensively.

And to whichever of you fine folks observed that I should mount /home on a separate partition:

Duh... I knew that.

Seriously, I did. I created my first SunOS fstab back in, oh, 1988, and my partition scheme was elegant, robust, and correct. Only, for some reason I simply can't fathom, it didn't occur to me to create separate partitions on my current IDE hard drive...it's only 167 GIGAbytes, you know, why would I ever want to slice it up?

Jumpin' Jehoshaphat, do I feel stupid tonight...

Thanks, guys.

CrashedAgain 01-26-2008 03:21 PM

Quote:

Originally Posted by philwynk (Post 3032797)
Hi,



....When I try to recover from my backup, it doesn't work. Typically, the X-windows install gets screwed up and the graphical environment won't boot, and since I don't know how to fix it, I end up having to reinstall the OS.

My system: I have two copies of the o/s on the hd...home is on a third partition and they both use the same separate /home partition. Grub shows both systems so I could boot into either one whenever I want to. Operationally, there is no difference & since /home is the same, you cannot actually tell which one is in use. Every so often I will update the backup system with a simple copy command (cp -prf /media/hdb3/* /media/hda8/) run from a run-from-cd system (Kanotix). I think the copy could be done from within the main operating system but not with the separate /home mounted...you don't want to copy the seaparate /home partition. fstab and grub are the only adjustments needed after updating the cloned system.

Just reverse the procedure to restore the main system...if it ever needs it. Mine never has, although I have used the restore procedure when I was trying some experimental setups etc & things got out of hand.

I also would second the poster above who recommended installing using yum....I use a Debian system instead of an rpm system because apt-get makes system maintenance easy. AFAIK yum is a close as an rpm system can get to apt-get. I have tried rpms (Mandrake) and some compile from source but it's usually just not worth the effort, the .deb files will be available before I can finish compiling.


Quote:


.....Windows is orders of magnitude more stable and friendly for desktop use than Linux. UNIX is a fine backend OS, great for network services, mainframe applications, file services, and other professional operations, but as a desktop environment, I could hardly be less satisfied. Maybe I'll try the Mac next (and yes, I know it's a UNIX implementation.)

Phil W.
I really have to disagree.

Only once have I ever had to do a complete reinstall...and that was a long time ago. (I was using an ext2 file system which didn't handle itself well when the disk went to 100% full.) Sometimes I have had to reinstall applications but never the whole o/s. Windows, on the other hand, often takes the entire o/s with it when anything crashes and even simple things often cannot be fixed without a complete reinstall. Compared to Ubuntu or Debian netinstall, installing windows is an absolute PITA and the Linux systems are complete (no extra installs needed for word porcessors, & other apps). The Linux systems can then be updated to the very lastest version with only two commands: "dselect update" followed by "apt-get upgrade".

Don't give up on Linux until you have at least tried a Debian based system.


All times are GMT -5. The time now is 05:52 AM.