LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Backing Up / Restoring (https://www.linuxquestions.org/questions/linux-software-2/backing-up-restoring-365347/)

Arrowx7 09-20-2005 03:58 PM

Backing Up / Restoring
 
Hello guys I have a question,
I have a drive with 3 partitions, one of which is linux FC4. I was wondering if I could backup the linux partition image, reformat the entire drive, and then repartition it, and restore the linux partition image on one of the partitions.
Is this possible? how can I get linux's image.

Thanks in advance guys!

Mega Man X 09-20-2005 04:18 PM

How does your file system looks like? I mean, I like to keep all my important things at /home/, so when I need to make a backup, format and restore, I simple compress all my /home/ with tar and gunzip and then when the system is fully reinstalled, I simply uncompress the file at my home again. Even the config files for every individual applications are saved (I'm referring to those hidden files/folders starting with a dot).

That should be the easiest way to backup/restore a system. If you want/can use this method, then simply:

tar cvf files.tar /home/user

where c = create, v = verbose, f = to file output(?) instead of using tape archive

tar(short for tape archiver, when we actually used tapes to store data...does anyone still uses that by the way? ghehe...) won't actually compress anything, but archive the file structure and create one file (here suggested as files.tar) where user is your actual user. Before compressing, it's always a good idea to look inside the file to see if the structure is correct:

tar tv files.tar

where t=table of contents, v=verbose. If everything looks fine, then compress it:

gzip -cv files.tar

c=create, v=verbose. You can use other tools for compressing, such as "compress" (old) or "jar" (does not compress as well as "compress" or "gzip"...).

When you are done backing up your files and your new system is completely restored, then create a new home directory:

mkdir /home/newuser
cd newuser


and uncompress the files:

gunzip files.tar.gz
tar xvf files.tar


where x=extract. You can, alternatively, extract individual files from the tar file. I use this when I've backup something that I don't need to restore right now (like wallpapers or other useless things that I might add later ;)). That is done with:

tar xvf files.tar filename1 filename2 filename3

Move the files if you need. When your file system structure is good enough, you can move the newhome to your user real name/home directory and hopefully, nothing was lost :D

Regards!

Arrowx7 09-20-2005 04:34 PM

Thanks a lot Megaman X! A great walk-through.
The only thing I fear is my drivers, which I'll probably lose. Is there a way to tar up and gzip the "/" directory, which is everything and then unzip it? Out of curiosity

Mega Man X 09-20-2005 04:50 PM

You're welcome :). Now that is a good question. Some "places" in the Unix file structure are created upon installation of the Operating system, such as /dev/. This can be a problem if you simply uncompress the hole root into it (thus places as /dev). A few encrypted things (as /etc/shadow) may be a little bit picky too. Setting/restoring permissions for the structure would not be very funny either.

There might be some backup/restoring applications for Linux that creates an exact copy of your system. I know, for example, that you can run 2 HD's in a machine where those HD's are actually mirrored. That is a great way of backing up files, in the case one of the HD's goes bad.

Since I've no experience with it, I will let a more experience Linux user (since I am an eternal newbie) to answer how to create an image of your root and then restore it. I'd also like to know if that's possible and how :D, ghehe.

Good luck!

Arrowx7 09-20-2005 05:22 PM

when I shut down linux, I can see that it compresses itself and all i get is a linux image /img/sysimage Is this the image file of the whole filesystem??

mfeat 09-20-2005 08:13 PM

a side note:

you can combine the tar and gzip by adding "z" to the command:

tar cvzf files.tar /home/user

and to extract:

tar xvzf files.tar

jailbait 09-20-2005 08:49 PM

One thing that you could consider is Mondo.

http://freshmeat.net/projects/mondorescue/

----------------------------------------
Steve Stites


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