ALWAYS backup /etc and /boot before making changes!
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
ALWAYS backup /etc and /boot before making changes!
Here is a fast note from the pain of experience. Aimed at new users:
/etc is where your gnu/linux stores it's configuration. Its function is similar to the Windoze registry. As you install, uninstall, and work with various programs, /etc changes. Sometimes, things change that make your system act unexpectedly.
A fairly easy way to backup, is to use a script. Don't panic, it's not difficult.
----- ----- -----
1) open a console
2) su
enter root password
3) # mkdir /var/backup
4) # vim /usr/sbin/prep4change
replace "vim" with text editor of your choice
5) cut and paste the following short script
##snip##
#!/bin/bash
Filename=/var/backup/$(date +%Y-%b-%d_%H:%M).bz2
echo "What is about to happen?"
read Note
echo $Filename."~".$Note >> /var/backup/notes
tar -cjf $Filename /etc/ /boot/
##snip##
6) save the file, and exit your editor
7) chmod 755 /usr/sbin/prep4change
this makes the script "executable"
----- ----- -----
All done!
Next time you are about to install, remove, or change something, just issue prep4change as root.
If the unthinkable ( but expected ) should happen, and things stop working correctly, you have your /etc and /boot already backed up.
Your backup will be located in /var/backup
You can also $ tail /var/backup/notes to see why you made what backup
Again, this isn't the most elegant, but it's simple, and it works! From my experience, the more bells and whistles something has, the more can go wrong!
Having also learned from the school of hard knocks, I used this script to backup the directories and it worked very well. However, prior to using it in preparation for system changes, I thought it would be prudent to ensure I could recover the directories. I found that when I decompressed the bz2 file, I could not extact the tar file.
I modifed the script provided for the definition of the file name, changing the output file extension as follows:
Filename=/var/backup/$(date +%Y-%b-%d_%H:%M).tbz
In doing so, the decompressed file is now recognised as a tar file and can be readily retrieved. Perhaps this was necessary due to changes to the bzip2 since the original post. I hope this suggestion proves to be helpful.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.