Backing up Linux files to tape

Posted on 2005-04-07
Last Modified: 2010-04-20
Hi guys,
Im pretty new to backing up.
We have hooked up a tape unit to a a linux box, and I want to basically know how I can:

1) Backup the whole linux system (like a ghost image of the machine - if that is possible)

2) Backup selected directories and subdirectories to tape

3) Backup individual files to tape

4) How to schedule a task using cron to automate this

Ive heard that cpio is good. Will it backup open files?

Any help greatly appreciated.
Question by:Simon336697
    LVL 48

    Expert Comment


    1) cd / ; tar cvf /dev/st0 /

    2) cd / ; tar cvf /dev/st0 /dir1 /dir2 /dir3/file1

    3) cd / ; tar cvf /dev/st0 /path/to/file1 /path/to/file2

    4) Simple way is to create a script in /etc/cron.daily, otherwise do 'crontab -e' and add an entry to run when you need.

    5) Most people use tar for backups over cpio.  Both will backup open files.  tar will warn you of any files that change while it is backing them up.  
    LVL 1

    Author Comment

    Hi Tintin!

    Mate thank you so much for this. Can I please bother you further.

    How would you do the following?

    I want to backup these things every night to tape:

    all files and subdirectories

    all files and subdirectories

    If the files are in use/open, I dont want to be prompted (as it is being backed up to tape and i wont be there)

    Id like a log made each night of the backup task.

    I dont want to use any 3rd party software to backup to tape, so I imagine cpio or tar can backup directly to tape?

    Id basically like the backup to be a full backup.

    Sorry to ask all these timeline of learning this is short.

    Thank you.

    LVL 48

    Assisted Solution

    You just need

    tar cf /dev/st0 /vmconfigs >>/var/log/backup.log 2>&1

    I'm assuming /dev/st0 is your tape device (is on most Linux systems).

    LVL 14

    Accepted Solution


    You probably wanna use /dev/nst0 (no-rewind scsi tape 0), if you don't you will overwrite your tape every night... Probably not what you want to do...

    All though tar is a fine tool you might find amanda to be a better solution in the long run, it will keep track off versions for you and give you a "ftp-like" recovery shell.

    Takes a bit of getting used to but well worth it in the end. (amanda is shipped with most distros)

    my 2 cents...

    LVL 14

    Expert Comment

    Hi again,

    I saw your question about open files...

    If it is a database file (i.e. oracle, MySQL, postgresql...) DO NOT back up the database file and think it will be any use to you...

    Other then that Linux doesn't suffer from the "open files" problem as much as windows...

    LVL 1

    Author Comment

    Thanks guys!!!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now