LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices



Reply
 
Search this Thread
Old 06-05-2009, 01:35 AM   #1
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Rep: Reputation: Disabled
why is my backup file bigger than the original?


My backup (tar) file is 5.3 GB, and the original file is only 3.66 GB.

To backup I use the command:
Code:
tar -cvf /media/disk/filename.tar  /
Anyone have any ideas why the backup is a different size?
thanks in advance.
 
Old 06-05-2009, 01:47 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
You don't want to backup the root directory. Back up the directories that need backing up. For example, if you backup up /proc, you will be backing up the entire core and pseudo files which will never be restored. The files in /dev are created when you boot up. The files in /sys are pseudo files created by the kernel when they are read. Backing up /tmp is wasteful. Many people have /tmp cleared out when the reboot.
Also don't back up /media or /mnt. You will be backing up external filesystems, maybe even the filesystem you are backing up to.

Also look at the options for tar. Make sure that you are backing up symbolic links as symbolic links and not dereferencing then. That can lead to an increase in size of the backup. Instead of backing up the location of the file, you will be backing up the file itself, creating a copy of the file. The copy of the file won't change when the original does.

Another thing to consider is how sparse files are backed up. You want to back them up as sparse files and not with zero's filling in the unused space.
 
Old 06-05-2009, 02:48 AM   #3
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
jschiwal
thank you for your prompt and informative reply. I sometimes suffer from "windows disease" and try to do certain things the same way in Linux.

Code:
You don't want to backup the root directory. Back up the directories that need backing up.
I see that now. Can you tell me what files/directories I should back up in case of system failure? I think /home/joe ? What else would I backup if i want to restore my system to the way it is now?

Thanks again
 
Old 06-05-2009, 10:55 AM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,919

Rep: Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778
Quote:
Originally Posted by joseph2020 View Post

I see that now. Can you tell me what files/directories I should back up in case of system failure? I think /home/joe ? What else would I backup if i want to restore my system to the way it is now?
Well, if you can rely on re-installing, you don't need that much. (To rely on re-installing, you probably want to treat your install disks as precious objects; when it comes down to it, you may, or may not, want to re-install the exact same version, but having the option is good).

(The alternative of a block-by-block copy on to the new system could be problematic if the new system isn't exactly the same as the old one, so I don't like relying on this; some people think its bound to be 'fixable' though; I'm not sure, but I am sure that if I rely on this, it will be problematic (that word again!) to get it done in zero time.)

Really you need he home directories for all of your users (is /home/joe everything?) and you probably want to keep a copy of /etc for reference. I certainly don't advise that you just overwrite your new /etc with the old one - that is likely to be problematic, but, if you have difficulty getting a service configured that you had once succeeded with, having the old .conf is potentially helpful.
 
Old 06-05-2009, 06:20 PM   #5
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
salasi

thanks for your helpful response.
Quote:
Really you need he home directories for all of your users (is /home/joe everything?) and you probably want to keep a copy of /etc for reference. I certainly don't advise that you just overwrite your new /etc with the old one - that is likely to be problematic...
I am the only user, so yes, /home/joe is the only one. So if I understand you correctly, I should backup that and the /etc directory. That sounds nice and easy, but why would it be "problematic" to just replace the old /etc with the new one? As a new Linux user I am always trying to learn as much as possible.

Thanks again
 
Old 06-06-2009, 05:11 AM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,919

Rep: Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778Reputation: 778
Quote:
Originally Posted by joseph2020 View Post

I am the only user, so yes, /home/joe is the only one.
...hmm, yes, but bear in mind that if you used the root account (so probably not that applicable for *buntu users), the root user might have some scripts in his bin subdirectory that would also need backing up.

Quote:
but why would it be "problematic" to just replace the old /etc with the new one?
In the case that your new install is of a newer distro (or just a different distro) you would be overwriting the config files for the newer versions of the various services with (your hand tuned) older ones. That might work, it might be a disaster, so you are better off not comitting to doing it.

So you might restore your backed up /etc to something like /etc/old/.... You'd the look at the services that you are running (squid, bind, nfs,...) one by one.
  • Check version numbers. If you are comparing, eg, squid 2.4.1 with squid 2.4.1, there is quite a good chance that your old config would work
  • If you are comparing squid 3.0.1 with 2.4.1, the chances are much lower that it will 'just work' without further attention
Even then it is far from guaranteed: in particular, with squid, there are many config options that may or may not be built in to a particular build of squid. The end result is that a .conf for one build of squid 2.4.1 may be incompatible with a different build of 2.4.1 (and if you specify an option that your build doesn't know about, it just bombs out).

If you are getting this kind of problem, you want to deal with them one-by-one rather than just having a massive mess of errors from a large number of different services while nothing is working. For example, if you break something in networking, you might be unsure of whether other things that rely on networking that break are broken in themselves, or are only broken because some other service on which they rely is broken.

And, obviously, you wouldn't just delete the installed config files; you'd rename/move them, just in case, that you did need them, even for comparison.
 
Old 06-06-2009, 04:32 PM   #7
fragos
Senior Member
 
Registered: May 2004
Location: Fresno CA USA
Distribution: Ubuntu 10.10
Posts: 1,466

Rep: Reputation: 51
In my home dir I keep copies of any configuration files from /etc that I edited. I also keep copies of any scripts I may have written and stored in /usr/local/bin. You'll find a number of occurances of dir /local or .conf.local which are intended for the user to make changes and be comfortable those files wouldn't be replaced during an ap upgrade. I save copies of those as well in my home dir.
 
Old 06-06-2009, 04:53 PM   #8
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
salasi, thank you for the excellent response.

fragos, thanks for the great idea
 
Old 06-06-2009, 11:40 PM   #9
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
If you are starting from a fresh install, using dd to create an image backup would enable you to recover the quickest from a drive failure to a state you were in when you initially started. You may want to zero out a previously used drive before a fresh install. That way, you can pipe the output of dd through gzip or bzip2 to compress the image to a more manageable size. You can also use the `df' program to tell you how much space is left in a partition, and then set dd's "count=" argument appropriately to fill unused space with a zero filled file. Delete the file afterwards. Now the partition will compress nicely.

Or your first backup could include all of the directories except those that you don't want to backup. The final arguments to tar can contain all of them. You could create one large initial backup using tar and afterwards use the -g option to only backup new files. I would recommend backing up the /home partition separately. Also, most people create a separate partition for home. This is where all of your personal files will be in. You can even rename it, reinstall (not formatting /home), and pull what you want from your old /home/user directory.

Look in the tar info file, and search for "incremental dumps". There is also an example using tar on both sides of a pipe to replicate files from one directory to another. One thing I've tried was something like:
tar -C /home -g timestampfile -cf - | tee /mnt/disk/backups/backup.tar | ssh user@host tar -C /home -xvf -

This replicates new files from home on one computer to another (even over the internet) while simultaneously creating an incremental backup on an external drive.
 
Old 06-07-2009, 02:50 AM   #10
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
jschiwal, thanks for your reply, but I am not yet "linux smart" enough to understand anything you wrote. I do appreciate your effort though.
 
  


Reply


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
Utterly fascinating boot sector problem: "Differences: (offset:original/backup)" Bert Linux - Software 4 07-01-2013 06:29 PM
/proc/kcore file is getting bigger and bigger. thewhitelion Ubuntu 2 03-07-2008 10:50 AM
Zip file bigger? Tux-O-Matic Linux - Software 3 11-01-2006 06:19 AM
Samba when I delete the original file sometimes deletes backup ewlnxnewB Linux - Newbie 6 11-20-2003 02:30 AM
Sampling bits of information in bigger and bigger pieces lugoteehalt General 0 10-29-2003 06:38 AM


All times are GMT -5. The time now is 12:22 PM.

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