Info

myufsbackup is a Perl script to backup a MySQL database on recent versions of FreeBSD. It creates a readonly, consistent snapshot of the filesystem which contains the database files. For this it makes use of the snapshot feature provided by the UFS2 filesystem. Prior to creating the snapshot it urges the MySQL server to flush all buffers to disk and to acquire a read lock. So far, myufsbackup is similar to Lenz Grimmer's mylvmbackup. But, after creating the snapshot and mounting this snapshot (eg. as /backup), myufsbackup will exit. You might then backup this directory (/backup), for example with BackupPC. Afterwards you call myufsbackup with the -u parameter to unmount and to remove the snapshot.

myufsbackup

myufsbackup V0.1

usage: myufsbackup [-c <configfile>] [-f] [-u] [-v]
       myufsbackup [--help]
       myufsbackup [--version]

    -c <configfile>    use given configfile instead of
                       /usr/local/etc/myufsbackup.conf
    -f                 force: do not die on error
    -u                 unmount: detach snapshot instead of creating it
    -v                 verbose mode: print out what is done
    --help             this help ;-)
    --version          print version

myufsbackup.conf

myufsbackup will override its internal default values with those from /usr/local/etc/myufsbackup.conf or any other readable configfile specified with the -c parameter. The configfile given below shows all available options and reflects the internal default values:

# default myufsbackup configfile

# database connection details
dbhost = ""
dbport = 3306
dbsock = "/tmp/mysql.sock"
dbuser = "root"
dbpass = ""

# filesystem containing the database files
backupdir = "/var"

# subdirectory of backupdir where the snapshot will be created in
snapdir = ".snap"

# name of the snapshot
# => qualified path will /var/.snap/myufsbackup
snapname = "myufsbackup"

# where the snapshot gets mounted
mountdir = "/backup"

# number of the memory disk to use for the snapshot
mdunit = 2

# do an extra "FLUSH TABLES" prior to "FLUSH TABLES WITH READ LOCK"
extraflush = 1

# usally you do not have to change these
mount = "/sbin/mount"
mdconfig = "/sbin/mdconfig"
umount = "/sbin/umount"

Todo

Download

Releases