diff --git a/INSTALL b/INSTALL index c5e0fccf..5c9af39d 100644 --- a/INSTALL +++ b/INSTALL @@ -11,9 +11,10 @@ type: make install -then change the example configuration file snapraid.conf to fit -your needs and copy it in /etc/snapraid.conf. +then change the example configuration file snapraid.conf.example +to fit your needs and copy it in /etc/snapraid.conf The documentation is in the man page: man snapraid + diff --git a/Makefile.am b/Makefile.am index 919e8c88..9f689613 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = snapraid -check_PROGRAMS = testgen +check_PROGRAMS = mktest snapraid_SOURCES = \ snapraid.c \ @@ -33,8 +33,8 @@ noinst_HEADERS = \ tommyhashdyn.c \ tommylist.c -testgen_SOURCES = \ - testgen.c +mktest_SOURCES = \ + mktest.c EXTRA_DIST = \ autogen.sh \ @@ -63,29 +63,34 @@ check-local: mkdir test/disk1 mkdir test/disk2 mkdir test/disk3 - echo Create some files, sync and check - ./testgen 1 3 2000 + echo --- Create some files, sync and check + ./mktest generate 1 3 1000 4000 ./snapraid -c $(srcdir)/test.conf sync ./snapraid -c $(srcdir)/test.conf check - echo Create some more files, sync and check - ./testgen 2 3 2000 + echo --- Create some more files, sync and check + ./mktest generate 2 3 1000 4000 ./snapraid -c $(srcdir)/test.conf sync ./snapraid -c $(srcdir)/test.conf check - echo Delete some files, fix and check + echo --- Delete some files, fix and check rm test/disk1/a* ./snapraid -c $(srcdir)/test.conf check 2>/dev/null ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null ./snapraid -c $(srcdir)/test.conf check - echo Delete the parity, fix and check + echo --- Delete the parity, fix and check rm test/parity ./snapraid -c $(srcdir)/test.conf check 2>/dev/null ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null ./snapraid -c $(srcdir)/test.conf check - echo Corrupt the parity, fix and check - dd if=/dev/zero of=test/parity bs=1024 count=1000 seek=1000 conv=notrunc + echo --- Corrupt the parity, fix and check + ./mktest damage 1 10 10000 test/parity ./snapraid -c $(srcdir)/test.conf check 2>/dev/null ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null ./snapraid -c $(srcdir)/test.conf check + echo --- Corrupt some files, fix and check + ./mktest damage 1 1 500 test/disk2/b* + ./snapraid -c $(srcdir)/test.conf check 2>/dev/null + ./snapraid -c $(srcdir)/test.conf fix 2>/dev/null + ./snapraid -c $(srcdir)/test.conf check echo Success! valgrind: diff --git a/README b/README index e8392241..a529d906 100644 --- a/README +++ b/README @@ -2,9 +2,29 @@ SnapRAID ======== SnapRAID is a backup program for a disk array using redundancy. -Just like a RAID system but based on snapshots. + +SnapRAID uses a disk of the array to store redundancy information, +and it allows to recover from a complete disk failure. + +SnapRAID is mainly targeted for a home media server, where you have +a lot of big files that rarely change. + +The main features of SnapRAID are: + +* You can start using SnapRAID with already filled disks. + You do not have to reformat or copy your data. +* The disks of the array can have different sizes. + You have only to use the biggest one for the redundancy data. +* If you accidentally delete some files in a disk, you can + recover them. +* If more than one disk fails, you lose the data only on the failed disks. + All the data in the other disks is safe. +* It doesn't lock-in your data. + You can stop using SnapRAID at any time. The official site of SnapRAID is: http://snapraid.sourceforge.net + + diff --git a/config.h b/config.h index eb91b443..b3e6c060 100644 --- a/config.h +++ b/config.h @@ -119,7 +119,7 @@ #define PACKAGE_NAME "snapraid" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "snapraid 0.1" +#define PACKAGE_STRING "snapraid 0.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "snapraid" @@ -128,7 +128,7 @@ #define PACKAGE_URL "http://snapraid.sourceforge.net" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.1" +#define PACKAGE_VERSION "0.2" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -159,7 +159,7 @@ /* Version number of package */ -#define VERSION "0.1" +#define VERSION "0.2" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/configure.ac b/configure.ac index 74c469bb..61181f04 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([snapraid], [0.1], [], [], [http://snapraid.sourceforge.net]) +AC_INIT([snapraid], [0.2], [], [], [http://snapraid.sourceforge.net]) AM_INIT_AUTOMAKE([foreign no-dependencies]) AC_CONFIG_SRCDIR([snapraid.c]) AC_CONFIG_HEADER([config.h]) diff --git a/mktest.c b/mktest.c new file mode 100644 index 00000000..98251f61 --- /dev/null +++ b/mktest.c @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2011 Andrea Mazzoleni + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "portable.h" + +/** + * Pseudo random number generator. + */ +unsigned long long seed = 0; + +unsigned rnd(unsigned max) +{ + seed = seed * 6364136223846793005LL + 1442695040888963407LL; + + return (seed >> 32) % max; +} + +void generate(int disk, int size) +{ + char path[PATH_MAX]; + char name[PATH_MAX]; + FILE* f; + int count; + int i; + int l; + + l = 1 + rnd(32); + + for(i=0;i SnapRAID uses a disk of the array to store redundancy information, -and it allows to recover from a complete disk failure. +and it allows to recover from a disk failure.

-SnapRAID is based on the snapshot concept like a backup program. -You decide the time to make the "sync" of the redundancy information, -and you are able to restore all the changes done at a disk of the array, -until the "sync". +SnapRAID is mainly targeted for a home media server, where you have +a lot of big files that rarely change.

The main features of SnapRAID are:

+

+The official site of SnapRAID is: +

+
+
+http://snapraid.sourceforge.net
+
+

3 Limitations

SnapRAID is in between a RAID and a backup program trying to get the best -benefits of them. Altough it also has some downsides that you should -consider before using it: -