Librenix
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Rsnapshot: Archive, Snapshot, Backup MySQL Databases on Debian

Up
vote
Down

This howto will show you how to install and set up Rsnapshot, enable archiving of snapshots and how to back up MySQL databases on Debian. Rsnapshot is a filesystem snapshot utility for making backups of local and remote systems. Using rsync and hard links, it is possible to keep multiple, full backups instantly available. The disk space required is just a little more than the space of one full backup, plus incrementals. read more...
permapage | score:9391 | -falko, January 14, 2013

Scripting: A parallel Linux backup script

Up
vote
Down

This example bash shell script demonstrates a simple method of creating backups of multiple filesystems to multiple tape devices simultaneously. While the script presented writes to four tape drives in parallel, it can easily be modified to write to other device types and to create a different number of backup streams. The script is set up for the bash shell under Linux, but modifying it for another variety of Unix should simply be a matter of changing the locations of utility files such as tar, echo, cp, and sleep.

The script can be downloaded from http://librenix.com/scripts/par.tar.sh. Download the file now and load it into an editor as this article will refer to it frequently. Also, you may want to modify bits of it to match your filesystem names and your devices.

The first line of the script looks like this:
 #!/bin/bash
If the bash shell isn’t in the /bin directory on your system, you’ll need to modify this line. Enter the command which bash now to verify the location of bash. My Fedora Linux system and my Mac OS X system both have bash in /bin, but my FreeBSD system does not. If you have a non-Linux flavor of Unix, you’ll probably need to use the ‘which’ command to verify the locations of each command used in the script. The commands used are:
 bash
cd
sleep
echo
date
tar
wait
ls
wc
Note that ‘wait’ and ‘cd’ are usually implemented as internal shell commands and may not have external commands associated with them. If that is true for your system, leave ‘cd’ and ‘wait’ with no directory prefix just as they are in the original script.

Now, the first command in the script resets the current working directory to ‘/’:
 cd /
Since the script precedes each directory to be backed up with a ‘.’ to represent the current working directory, starting out at ‘/’ is necessary. The reason for this precaution is that some implementations of the tar command will only load files from a tar archive into the exact directory that was specified when the file was backed up. By prefixing the names with a ‘.’ we preserve the ability to recover the files into any subdirectory we want, without overwriting the original files.

Immediately after the ‘cd /’ command is where you would put any commands to shut down all services that must be quieted prior to a backup. The example script has a (commented out) command to initiate an Oracle database shutdown followed by a ‘sleep’ command to allow time for the shutdown to complete. The example database shutdown and the following delay probably don’t apply to your system. Obviously, you’ll have to add commands yourself to stop any applications that might interfere with the backup.

Next, we use the ‘date’ command to create two sets of four tiny files to stick at the start and end of each tape. Note that the presence of a ‘date.#’ file at the beginning of each tape lets you quickly find out when a tape was created and on which drive. The ‘zzzz.#’ files, appended to the end of each tape, only serve to let you easily verify that a backup completed without overrunning the end of the tape.

Next, we start the four actual ‘tar’ backup commands, each with sample directories named ‘./dir1’, ‘./dir2’, etc. Of course, you’ll need to modify the list of directories to match the actual directories you wish to back up. Note that you’ll probably want to balance the directory sizes so that all of the largest directores aren’t on the same tape. Also, note that each ‘tar’ command is run in the background and logs to a tar.#.log file in the /tmp directory. Obviously, you might want to put the logfiles somewhere else.

After each ‘tar’ command there is an entry like this: ‘TASK=$0’, or ‘TASK=$1’. These arbitrarily-named ‘TASK’ variables are used to store the process ID of each ‘tar’ command so that the script can wait for them with the four ‘wait’ commands that follow in the next block of code. There, we have the four ‘wait’ commands waiting on the $TASK0, etc, variables. (The addition of the ‘$’ to each TASK# shell variable is not a typo -- it’s necessary to read back the contents of the variable.)

Next, after the script has waited for the completion of each of the four ‘tar’ commands, it appends some information to a history file for later reference. It stores the date of the backup, the filesize of the logfile, and the number of files backed up on each tape to each of four history files. While the script will overwrite the logfiles (tar.#.log) each time it is run, it will append these three lines to each of the four history files (tar.#.history).

The final steps in the script are commented out. Those are the commands necessary to restart any applications that were brought down for the backup. Again, in the example we assume an Oracle database needs to be restarted. You’ll need to add the commands necessary to start any applications that were stopped at the beginning of the script.
mail this link | permapage | score:9116 | -Ray, April 10, 2005

Back up MySQL Databases with mylvmbackup on Ubuntu 12.10

Up
vote
Down

mylvmbackup is a Perl script for quickly creating MySQL backups. It uses LVM's snapshot feature to do so. To perform a backup, mylvmbackup obtains a read lock on all tables and flushes all server caches to disk, creates a snapshot of the volume containing the MySQL data directory, and unlocks the tables again. This article shows how to use it on an Ubuntu 12.10 server. read more...
permapage | score:8980 | -falko, January 17, 2013

Backup Linux to Amazon S3 with s3cmd

Up
vote
Down

S3cmd is a program that allows you to backup your Linux box to Amazon S3. Amazon S3 allows you basically unlimited storage and, as long as you have the bandwidth, you can use it from any location. There are two options in a backup that you can use: you can either copy all the files over to an S3 bucket (called put) or you can use the sync command to sync file changes on a regular basis. read more...
permapage | score:8936 | -pinehead, April 2, 2012

Tutorial: Making Linux / UNIX snapshot backups

Up
vote
Down

I’d like to configure my Debian box to backup two remote servers using rsnapshot software. It should make incremental snapshots of local and remote filesystems for any number of machines on 2nd hard disk located at /disk1 ( /dev/sdb2). How do I make backups?

rsnapshot saves much more disk space than you might imagine. The amount of space required is roughly the size of one full backup, plus a copy of each additional file that is changed. rsnapshot makes extensive use of hard links, so if the file doesn’t change, the next snapshot is simply a hard link to the exact same file. read more...
mail this link | permapage | score:8902 | -nixcraft, February 12, 2008

Back up MySQL Databases with mylvmbackup on Debian 6

Up
vote
Down

mylvmbackup is a Perl script for quickly creating MySQL backups. It uses LVM's snapshot feature to do so. To perform a backup, mylvmbackup obtains a read lock on all tables and flushes all server caches to disk, creates a snapshot of the volume containing the MySQL data directory, and unlocks the tables again. This article shows how to use it on a Debian Squeeze server. read more...
permapage | score:8823 | -falko, May 11, 2012

MySQL backup script

Up
vote
Down

A bash shell script to back up your MySQL databases...
If you host your own blog or any Web-based application running on the Apache/MySQL/PHP stack, you should have a backup system in place for keeping data stored in MySQL databases safe. There are several solutions that can help you with that, but nothing beats a simple Bash script I stumbled upon in a blog post comment. Here is the script in all its beauty:
read more...
permapage | score:8670 | -Ray, January 17, 2011

Online backup services for Linux

Up
vote
Down

A baker's dozen online backup services that work with Linux:
Part 1
Part 2
It can also be useful for users who need to sync some of their data across two or more computer machines most of the time.

An online backup system is usually built around client software that runs on a schedule, but some can work continuously, backing up files as they are changed. It collects, compresses, encrypts, and transfers the files to the remote backup service provider's servers.
read more...
mail this link | permapage | score:8664 | -Ray, January 12, 2011

Bacula Network Backup Implementation Guide

Up
vote
Down

This is very detailed tutorial for implemeting bacula network backup in debian linux. This tutorial consists of four pages.

Bacula is a set of computer programs that permits you (or the system administrator) to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bacula can also run entirely upon a single computer, and can backup to various types of media, including tape and disk.

In technical terms, it is a network Client/Server based backup program. Bacula is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. Due to its modular design, Bacula is scalable from small single computer systems to systems consisting of hundreds of computers located over a large network. read more...
mail this link | permapage | score:8601 | -gg234, June 7, 2006

Back up Fedora files with Fwbackups

Up
vote
Down

This document describes how to set up, configure and use Fwbackups on a Fedora 8 desktop. The result is an easy-to-use backup system for desktop usage. Fwbackups creates partial backups which can be stored locally or on a removable device. You have also the option to run scheduled backups. read more...
permapage | score:8591 | -falko, February 28, 2008

Easy backup with lftp

Up
vote
Down

Upload and download with lftp...
No matter what Linux distribution you are using, chances are you'll find more than one graphical FTP client in its repositories, but if you are looking for a powerful command-line FTP tool, your best bet is lftp. Of course, you can always use the good old ftp command, but lftp takes the task of managing files and directories using the FTP protocol to a new level. To see what I mean, let's use lftp to write a script that creates a local backup copy of a Web site.
read more...
mail this link | permapage | score:8436 | -Ray, December 4, 2007

Tutorial: Postfix backup mail server anti-spam setup

Up
vote
Down

According to RFC2821 the lowest-numbered records are the most preferred MX for domain. So a target Postfix backup server is used to keep the messages in a queue waiting for the primary server to become available. This ensures that if my primary MX goes down you do not loss any emails. However, spammers are connects to backup MX to avoid anti spam filters that are running on the primary MX server. This also hides their real IP from my primary MX. This tutorial shows how to configure anti-spam and anti-virus for Red Hat / CentOS Linux ver5.3 based Postfix mx server. read more...
mail this link | permapage | score:8421 | -nixcraft, May 5, 2009

Tutorial: Automate remote system backup with rsync

Up
vote
Down

This article comes complete with example shell scripts and crontab entries.
In this article we explain how to automate the backup of files on remote machines to a centralized server using rsync.

rsync is a command line utility that is used to synchronize files between two computers over a network to synchronize files between two filesystems. It was written as a replacement for rcp but with many new features. For example it uses an algorithm that will only transfer files that have been modified. SSH will be used to authenticate between the machines and to encrypt the network traffic.
read more...
mail this link | permapage | score:8394 | -Ray, August 9, 2005

Bacula: Backup software for Linux

Up
vote
Down

An introduction to Bacula including configuration files...
If one just wants to backup a few files on random occasions then Bacula is not the software to use. But if one wants to run regular, scheduled backups to just about any type of storage media then Bacula will most definitely work.

I must admit, I have been a tar + cron Unix guy for over 20 years and never really considered anything else necessary for backups on Unix, until now.
read more...
permapage | score:8334 | -Ray, March 28, 2011

Ubuntu backup with TimeVault

Up
vote
Down

A useful and simple backup utility...
TimeVault makes saving and recovering data easy through an automatic process. You define directories to include or exclude from the process, and TimeVault takes care of the rest by creating snapshots of your data. A snapshot is a clone of a directory at a point in time. Files are copied if they've changed since the last snapshot. If a file hasn't changed, it is simply referenced to an older snapshot and no space is used for backing it up. Snapshots are read-only, so they are protected from accidental deletion or modification. If you are the root user, you can delete intermediate snapshots without harming the rest of them.
read more...
mail this link | permapage | score:8313 | -Ray, November 13, 2008

A simple backup rotation with rsnapshot

Up
vote
Down

Rsync shows up again in a backup solution...
rsnapshot is a lightweight backup solution which creates rotated backups of local or remote directories. One of the key benefits of rsnapshot is its extreme simplicity. As a bonus backups are created using hardlinks to reduce the space used upon the backup host.

Like many backup solutions rsnapshot is a script which is built upon a foundation of OpenSSH and Rsync - the latter being used to synchronise directory contents without using excessive bandwidth, and the former to ensure the communication is encrypted and secure.
read more...
mail this link | permapage | score:8231 | -Ray, August 23, 2005

JBackpack: Personal backup program

Up
vote
Down

JBackpack is a personal backup program. It features incremental backups, network transparency and encryption. JBackpack uses rdiff-backup for all backup and restore functions, SSHFS and SMB to access remote file systems and EncFS to encrypt backup destination directories.JBackpack uses rdiff-backup for all backup and restore functions. The most interesting feature of rdiff-backup is incremental backups. read more...
permapage | score:8221 | -gg234, April 23, 2012

mysqlhotcopy: Hot Backup of MySQL

Up
vote
Down

If you need to make live backups of your MySQL database, this is how you can do it.
If you want to make a hotcopy from your SQL database instead of a dump to a text file, you can use the mysqlhotcopy tool. This tool locks a table, copy it and than unlocks it again.

Use this command if you want to transfer the MySQL data to an other place on the same server...
read more...
permapage | score:8210 | -Ray, December 22, 2005

Amanda: Disk backup on Debian

Up
vote
Down

Amanda is an open source client/server solution to back up filesystems. Backups are triggered by the backup server, backup definitions are located on the servers but exclusion lists are located on the client. read more...
permapage | score:8178 | -falko, June 17, 2010

Tutorial: Set up Postfix as a backup MX

Up
vote
Down

In this tutorial I will show how you can set up a Postfix mailserver as a backup mail exchanger for a domain so that it accepts mails for this domain in case the primary mail exchanger is down or unreachable, and passes the mails on to the primary MX once that one is up again. read more...
permapage | score:8173 | -falko, June 25, 2007
More articles...
Fine Art Online Gallery

Selected articles

Apple to Intel move no threat to Linux

Linux dominates Windows

Why software sucks

Why Programmers are not Software Engineers

Space Tyrant: Multithreading lessons learned on SMP hardware

The short life and hard times of a Linux virus

No, RMS, Linux is not GNU/Linux

MiniLesson: An introduction to Linux in ten commands

Hacker Haiku

VPS: Xen vs. OpenVZ

Space Tyrant: A multiplayer network game for Linux

Currency Traders Telnet Game

Space Tyrant: A threaded game server project in C

Missing the point of the Mac Mini

How to install Ubuntu Linux on the decTOP SFF computer

Shadow.sh: A simple directory shadowing script for Linux

Graffiti Server Download Page

Programming Language Tradeoffs: 3GL vs 4GL

Scripting: A parallel Linux backup script

Download: Linux 3D Client for Starship Traders

The life cycle of a programmer

Beneficial Computer Viruses

The Supreme Court is wrong on Copyright Case

Apple DIY Repair

The Network Computer: An opportunity for Linux

Librenix T-Shirts and Coffee Mugs!

Space Tyrant: A threaded C game project: First Code

Microsoft to push unlicensed users to Linux

Mono-culture and the .NETwork effect

The Real Microsoft Monopoly

Linux vs. Windows: Why Linux will win

Closed Source Linux Distribution Launched

Tutorial: Introduction to Linux files

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin