+ Reply to Thread
Results 1 to 5 of 5

Thread: Using Tar in linux to make a backup

  1. #1
    Onur Guest

    Smile Using Tar in linux to make a backup

    Using Tar in linux to make a backup This is just a small example of how you can use the TAR application with linux to generate a powerfull backup script triggered by a cron.

    You will need to create an archive , either using vi or touch.

    For example in this case lets say our script is called backup

    vi backup

    This will create the archive and open the vi editor, to add content to the archive press the I key to insert and then check out at my example here:

    #--------------------------------------
    #Beggining of script
    #--------------------------------------
    # Lets say you want to remove an old backup on autobackups folder
    rm /autobackups/mybackup*.*
    # Now lets say you want to make the script sleep for 3 seconds
    sleep 3

    #Now you want to backup /home entirely into /autobackups using tar

    tar -cvf /autobackups/home$(date +%y%m%d).tar /home

    #---END---

    Please notice that you are creating a tar archive with the whole content of /home and adding the date of the backup to the name of the archive. To execute this script, you need to save it , on VI press ESCAPE , then activate the CAPS LOCK and press the Z key 2 times. (zz)

    You will need to give the archive execute permissions, use the following command: chmod a+x backup , basically to run the script just type ./backup considering you are on the same path of the archive. Easy does it

  2. CODECALL Circuit advertisement

     
  3. #2
    rumen is offline Programmer
    Join Date
    Jun 2008
    Posts
    110
    Rep Power
    0
    Very helpful information when you want to make a backup, thanks for sharing!

  4. #3
    Tor
    Tor is offline Programming Expert
    Join Date
    Oct 2007
    Posts
    488
    Rep Power
    0
    It would be a big tarball for the entire drive though.

  5. #4
    senecaz is offline Newbie
    Join Date
    Feb 2009
    Posts
    16
    Rep Power
    0
    if you want backups, that can be a possible way. although the big footprint can easily be a hassle for small drives, nice tip btw.

  6. #5
    whwmia's Avatar
    whwmia is offline Newbie
    Join Date
    Aug 2009
    Posts
    24
    Rep Power
    0

    Re: Using Tar in linux to make a backup

    very helpful topic

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Incremental backup + windows + linux = ??
    By wim DC in forum Computer Software/OS
    Replies: 1
    Last Post: 05-18-2011, 03:30 PM
  2. Replies: 2
    Last Post: 03-31-2011, 06:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts