Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 06-02-2006, 06:37 PM   #1
Registered: Oct 2003
Posts: 110

Rep: Reputation: 15
System backup - I find it very confusing - help

I'm new to Debian. Used to use Mandrake. I have saved individual files and directories but never came up with a successful backup.

I know this has been written about to death but I can't seem to come up with a plan or a method...How do I backup my system?

I have already reinstalled so many times, because I practice and try stuff till my systems messed up and needs reinstalling since I haven't learned how to repair it yet. I would like to just run a command and have my system reload a copy that was previously backedup.

I can't see tuning up my system again until I learn to do backups.

I could save my directories to disk, but that take a lot of disks unless I only backup limited directories.

I think the best thing to do would be to clone my system to another hard drive, which I have installed in my pc. This is where I need to ask for the proceedure.

I currently use a 137gig harddrive and have a 20 gig drive installed but currently disconnected.


#1 Can I have 2 harddrives with the same OS at the same time?

#2a Do both harddrives need to be the same size?
b Do you copy the entire drive or just the used portion of the drive?

#3 What am I looking for...The proper software package for this purpose or the proper commands for this purpose?

Can someone point me in the right direction to get started.
Old 06-02-2006, 09:39 PM   #2
Registered: Jan 2004
Location: /dev/random
Distribution: Gentoo amd64, CrunchBang amd64
Posts: 350

Rep: Reputation: 32
Well, the best idea since you have a smaller drive is to back up your personal files and your system config files. Reinstalling software is easy (just make a list of what you have installed). Remembering what the rest was is tedious.

Here is a simple script that will backup /etc and /home:

#backup /etc
tar cpvujf $BACKUP_LOC/etc.tar.bz2  /etc

#backup /home
tar cpvujf $BACKUP_LOC/home.tar.bz2 /home
Of course, replace $BACKUP_LOC with where ever you want to put the backups
The u option makes the backups only replaces modified files in the archives (so you can run the script weekly or whatever) The p option makes it preserve permissions.

Restoring the backups is a simple as untarring the archives (in the root directory of course).

This script works for me, feel free to modify it however you wish.
Suggested reading:
man tar
Old 06-02-2006, 09:57 PM   #3
Registered: Oct 2003
Posts: 110

Original Poster
Rep: Reputation: 15
Thank you so much for the script. I will give it a try this weekend.

I have done the /home and /etc saves using K3B. Its a pain since K3B always gave me trouble in Mandrake.

Using your script, if I had a system crash, and assuming I haven't learned to repair it, I would then reinstall the system and restore /home and /etc off the extra hard disk. Right?

If I had a crash and didn't want to reinstall the entire system, isn't there a kernal file or something that I could have backedup and then restore? Where is it?
Old 06-06-2006, 01:59 PM   #4
Registered: Nov 2004
Distribution: Debian Unstable
Posts: 77

Rep: Reputation: 15
Well... there's the kernels in /boot/ and their modules in /lib/modules that you could make backups of but that's not going to help you much after a crash unless the crash removed some of those files. If the crash removed some other vital part of the file system you'd still need to reinstall.

Depending on how large your installed system is and which kind of backup media you can use you can of course make backups (tar files) of the other directorys too. For /proc, /sys and /tmp you don't need to backup their content, just the base directories. If you are using "udev" then you need to disable udev while you make a complete backup of /dev. The best way would be to boot from some linux live cd, like Knoppix or Mepsis.

Oh I almost forgot.... one thing that I would really, really REALLY recommend making a backup of is the layout of the partition table especially if you're dual-booting.Or make a printout of the following command:
fstab -l /dev/hda
Trust me, there's nothing more annoying then knowing that you have to wipe out a perfectly good installation because you or some bug-ridden piece of software couldn't keep their hands off the first kilobytes of your harddrive.
Old 06-07-2006, 12:25 AM   #5
Registered: Jul 2003
Location: near Seattle
Distribution: Debian/Ubuntu/Suse
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
Here is a script that I use to back up my main install (hostname noisy), and 2 other partitions containing images and mp3's, to folders on a separate partition (/mnt/hdb4), excluding a lot of unnecessary stuff:

#backup up noisy '/' to /mnt/hdb4
rsync -e ssh -avz --delete --exclude "/dev/*" --exclude "/mnt/*" --exclude "/proc/*" --exclude "/sys/*" --exclude "/tmp/*" --exclude "/home/*.old.tar.gz" --exclude "/home/ftp/*" --exclude "/var/www/storage/*" / /mnt/hdb4/Noisy_Backup
rsync -e ssh -avz --delete /mnt/hda7/ /mnt/hdb4/mp3/
rsync -e ssh -avz --delete /mnt/hda6/ /mnt/hdb4/images/

It creates a copy, only backing up changed files, and you can simply copy from the backup partition back to the original if you mess something up. Requires a big partition to hold the backup, of course, since it's not compacted.

This can be used to back up to a networked computer by using something like this:


instead of /mnt/whatever, where compaq is the remote hostname.

NOTE: Critiques welcome.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find out if my system is i386, i486, or i586? Is there a system info command? mlsbraves Linux - General 6 02-17-2009 04:08 PM
Hlep need to find a Backup Software for Linux randy1970 Linux - Enterprise 9 06-08-2006 06:42 PM
Can I find links in the system that point to certain files throughout the system? HGeneAnthony Linux - Newbie 3 02-18-2005 08:28 AM
system backup JROCK1980 Linux - Software 3 07-08-2004 03:56 AM
Confusing find command davidas Linux - Newbie 1 03-24-2004 06:26 AM > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration