Using tar for backups: Was "backing up kmail"

adams k7qo at
Thu May 3 16:50:56 BST 2007

On Thu, 2007-05-03 at 17:06 +0200, Donn wrote:
> > A problem not mentioned is that maildir renames files based on status with
> > names that are incompatible with the CD/DVD ISO format, so you can back
> > them up to an ext file system, but not easily to a CD-RW.
> Yes, good point. One would have to tar them up in some way I suppose.
> /d

Because of the way retrieving files, directories, etc. from an ISO
CD/DVD gives me the wrong permissions (I seem to lose write ability
as CD/DVD is read-only), I use tar for backups.  Writing the CD/DVD
using k3b.

In my home directory I have nothing but directories.  There are no
regular files.  Everything is in some directory or subdirectory.
All the directories at my home directory level are lower case
only and begin with a letter a-z.  They are short names that don't
generate conflicts with ISO naming conventions.

I do backups in the following manner.  Some/many may consider this
to be a pain, too difficult, messy, not the best way, .... but it
works for me, so I offer it as a possible way to  do the job.  I
realize that there may be other utilities and third party solutions
but I'm old fashioned and rather do it myself.

I make a directory in the home directory called 0_tarfiles with
the numeral 0 at the start to note it is different than the
other directories.

1.  To get all the hidden files (files that start with a period (.))

    in a console window execute the following:

    tar -cvf 0_tarfiles/dotfiles.tar .??*

    this gets the .files and .directories.   the ??* is important,
    very important so that . and .. don't become a part of the 
    expansion.  This makes sure that I get the .evolution directory
    that contains all my saved mail if I ever need to retrieve it
    for whatever reason(s).  And backups for other apps directories
    that may be of the form .dirAppName, e.g. .bash, .alias, .cshrc,
     ... etc.


    to get all the other directories and assuming a bash shell

    for i in [a-z]*
    tar -cvf 0_tarfiles/$i.tar $i

    You can

    du -sk 0_tarfiles

    to see just how large a media you need or multiple media discs.

3.  I then use k3b to get all the tar files onto one or more media discs
    and label the media appropriately.  I always have k3b verify the
    media after completing the write.

    And for those in the know you can use the backup media with tar -d
    option to verify that the info on the hard drive matches the media.

4.  If you need to retrieve all or part of the files on the media

    tar -xvf /media/cdrom/filename.tar
    ..repeat until done or use tar with options to retrieve single
      files....  user experience may be necessary to know all that
      you can do here.....

    I used k3b to write the *.tar files and not
    the 0_tarfiles directory name so the f/s on the media is flat
    and has no directories or sub-directories.

You ask "Why all the trouble?".  I'm guaranteed the files/directories
retrieved in this way have the permissions the way they were on the hard
drive at the time of the archival.  

works for me.  FYI   

Hope this helps someone.

Chuck Adams, K7QO   k7qo at   personal web page

Moving to Arizona?  Bring your own water.

More information about the kubuntu-users mailing list