Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-02-2010, 03:59 PM   #1
LQ Newbie
Registered: Mar 2010
Location: atlanta, georgia
Distribution: karmic kogla/kde desktop
Posts: 10

Rep: Reputation: 0
Question Backup - karmac and all files

I want to backup all files - karmac / my files / and all downloaded ones. Can u tell me of a program
to use. I want to restore my exact configuration if needed. I love what I have.
Old 06-02-2010, 04:24 PM   #2
LQ Newbie
Registered: Aug 2006
Posts: 25
Blog Entries: 1

Rep: Reputation: 18
This is the shell script I use to back up my Linux systems to a single, compressed file (typically 1-5GB depending on what is installed on your system).


if [ $# == 1 ]; then
        # one argument is the destination dir
        echo "$0 only takes one argument - the destination directory for the backup"
        exit 1

## We need options to tell tar to preserve owners and permissions
TAROPTS="--preserve-permissions --numeric-owner --same-owner"

# get the hostname
# and the date
datestr=`date +%Y%m%d`
# set the label and the file name to write to
TAROPTS="${TAROPTS} --file=${destdir}/${hostname}${datestr}.tar.gz"
TAROPTS="${TAROPTS} --label=${hostname}_system_backup_${datestr}'"

# be verbose and to compress the archive
TAROPTS="-v ${TAROPTS} --gzip"

#unless the user exports TMPDIR we put temp files in /tmp, which mktemp handles
# for us

#excludefile=`tempfile -p backup -s .lst -d ${TMP}`
excludefile="$(mktemp backupXXXXXXXXXX)"
# the file we will list stuff we don't care about into
# first off we exclude some directories completely because they will be
# re-created automatically
cat > "${excludefile}" << EOF
# some directories are created with specific permissions when packages are
# installed, so we need to back them up even if we don't back up their contents
# with tar the only option seems to be to list all the things we don't want
# to back up individually, having discovered them with find.
# don't include log files
#find /var/log -type f >> "${excludefile}"
# don't include run files, sockets etc
find /var/run -type f >> "${excludefile}"
find /var/run -type p >> "${excludefile}"
find /var/run -type s >> "${excludefile}"
# or cached files that can be re-generated or re-downloaded
#find /var/cache -type f >> "${excludefile}"

#that made us an grand exclude list for tar

TAROPTS="${TAROPTS} -X ${excludefile}"

mount "/boot"
# we don't want to loose the files in /boot
echo tar -c ${TAROPTS} "/"
tar -c ${TAROPTS} "/"

umount "/boot"
# done with boot now

\rm  "${excludefile}"
#clean up the exclude file
You will probably want to adjust the list of excluded directories to suit your system and what you do / don't want to back up. When you want to restore the backup, you have to format the disk (create the file systems), then just unpack the tarball into the new file system. After that, you can chroot into the file system and re-install the boot loader (which does get missed out), with either grub-install or lilo.
0 members found this post helpful.
Old 06-06-2010, 02:52 PM   #3
LQ Newbie
Registered: Mar 2010
Location: atlanta, georgia
Distribution: karmic kogla/kde desktop
Posts: 10

Original Poster
Rep: Reputation: 0
I am newer than this task needs. I am good enough to find what is and how to use a shell script though.
Thanku - this is my reason for using Linux. U have to read and gather most things. Thanks again for this.


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 backup files? MTK358 Linux - General 17 02-15-2010 09:46 AM
Where Are Some Files I Would Like To Backup? Harpo Linux - Newbie 3 01-07-2007 12:04 PM
text files and their automatic backup files AGazzaz Linux - General 1 07-01-2006 08:38 AM
How to backup files? yuchen99 Red Hat 6 04-23-2005 10:36 PM
backup files davidleroux1 Mandriva 0 12-01-2004 07:32 PM > Forums > Linux Forums > Linux - Software

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

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