.TH "FSVS - Backup HOWTO" 5 "11 Mar 2010" "Version trunk:2424" "fsvs" \" -*- nroff -*- .ad l .nh .SH NAME HOWTO: Backup \- .PP This document is a step-by-step explanation how to do backups using FSVS. This document is a step-by-step explanation how to do backups using FSVS. .SH "Preparation" .PP If you're going to back up your system, you have to decide what you want to have stored in your backup, and what should be left out. .PP Depending on your system usage and environment you first have to decide: .PD 0 .IP "\(bu" 2 Do you only want to backup your data in \fC/home\fP? .PD 0 .IP " \(bu" 4 Less storage requirements .IP " \(bu" 4 In case of hardware crash the OS must be set up again .PP .IP "\(bu" 2 Do you want to keep track of your configuration in \fC/etc\fP? .PD 0 .IP " \(bu" 4 Very small storage overhead .IP " \(bu" 4 Not much use for backup/restore, but shows what has been changed .PP .IP "\(bu" 2 Or do you want to backup your whole installation, from \fC/\fP on? .PD 0 .IP " \(bu" 4 Whole system versioned, restore is only a few commands .IP " \(bu" 4 Much more storage space needed - typically you'd need at least a few GB free space. .PP .PP .PP The next few moments should be spent thinking about the storage space for the repository - will it be on the system harddisk, a secondary or an external harddisk, or even off-site? .PP \fBNote:\fP .RS 4 If you just created a fresh repository, you probably should create the 'default' directory structure for subversion - \fCtrunk\fP, \fCbranches\fP, \fCtags\fP; this layout might be useful for your backups. .br The URL you'd use in fsvs would go to \fCtrunk\fP. .RE .PP Possibly you'll have to take the available bandwidth into your considerations; a single home directory may be backed up on a 56k modem, but a complete system installation would likely need at least some kind of DSL or LAN. .PP \fBNote:\fP .RS 4 If this is a production box with sparse, small changes, you could take the initial backup on a local harddisk, transfer the directory with some media to the target machine, and switch the URLs. .RE .PP A fair bit of time should go to a small investigation which file patterns and paths you \fBnot\fP want to back-up. .PD 0 .IP "\(bu" 2 Backup files like \fC*\fP.bak, \fC*~\fP, \fC*\fP.tmp, and similar .IP "\(bu" 2 History files: \fC.sh-history\fP and similar in the home-directories .IP "\(bu" 2 Cache directories: your favourite browser might store many MB of cached data in you home-directories .IP "\(bu" 2 Virtual system directories, like \fC/proc\fP and \fC/sys\fP, \fC/dev/shmfs\fP. .PP .SH "Telling FSVS what to do" .PP Given \fC$WC\fP as the \fIworking directory\fP - the base of the data you'd like backed up (\fC/\fP, \fC/home\fP), and \fC$URL\fP as a valid subversion URL to your (already created) repository path. .PP Independent of all these details the first steps look like these: .PP .nf cd $WC fsvs urls $URL .fi .PP Now you have to say what should be ignored - that'll differ depending on your needs/wishes. .PP .nf fsvs ignore './**~' './**.tmp' './**.bak' fsvs ignore ./proc/ ./sys/ ./tmp/ fsvs ignore ./var/tmp/ ./var/spool/lpd/ fsvs ignore './var/log/*.gz' fsvs ignore ./var/run/ /dev/pts/ fsvs ignore './etc/*.dpkg-dist' './etc/*.dpkg-new' fsvs ignore './etc/*.dpkg-old' './etc/*.dpkg-bak' .fi .PP .PP \fBNote:\fP .RS 4 \fC/var/run\fP is for transient files; I've heard reports that \fBreverting\fP files there can cause problems with running programs. .br Similar for \fC/dev/pts\fP - if that's a \fCdevpts\fP filesystem, you'll run into problems on \fBupdate\fP or \fBrevert\fP - as FSVS won't be allowed to create entries in this directory. .RE .PP Now you may find that you'd like to have some files encrypted in your backup - like \fC/etc/shadow\fP, or your \fC\fP.ssh/id_* files. So you tell fsvs to en/decrypt these files: .PP .nf fsvs propset fsvs:commit-pipe 'gpg -er {your backup key}' /etc/shadow /etc/gshadow fsvs propset fsvs:update-pipe 'gpg -d' /etc/shadow /etc/gshadow .fi .PP .PP \fBNote:\fP .RS 4 This are just examples. You'll probably have to exclude some other paths and patterns from your backup, and mark some others as to-be-filtered. .RE .PP .SH "The first backup" .PP .PP .nf fsvs commit -m 'First commit.' .fi .PP That's all there is to it! .SH "Further use and maintenance" .PP The further usage is more or less the \fCcommit\fP command from the last section. .br When do you have to do some manual work? .PD 0 .IP "\(bu" 2 When ignore patterns change. .PD 0 .IP " \(bu" 4 New filesystems that should be ignored, or would be ignored but shouldn't .IP " \(bu" 4 You find that your favorite word-processor leaves many *.segv files behind, and similar things .PP .IP "\(bu" 2 If you get an error message from fsvs, check the arguments and retry. In desperate cases (or just because it's quicker than debugging yourself) ask on \fCdev [at] fsvs.tigris.org\fP. .PP .SH "Restoration in a working system" .PP Depending on the circumstances you can take different ways to restore data from your repository. .PD 0 .IP "\(bu" 2 \fC 'fsvs export'\fP allows you to just dump some repository data into your filesystem - eg. into a temporary directory to sort things out. .IP "\(bu" 2 Using \fC'fsvs revert'\fP you can get older revisions of a given file, directory or directory tree inplace. .br .IP "\(bu" 2 Or you can do a fresh checkout - set an URL in an (empty) directory, and update to the needed revision. .IP "\(bu" 2 If everything else fails (no backup media with fsvs on it), you can use subversion commands (eg. \fCexport\fP) to restore needed parts, and update the rest with fsvs. .PP .SH "Recovery for a non-booting system" .PP In case of a real emergency, when your harddisks crashed or your filesystem was eaten and you have to re-partition or re-format, you should get your system working again by .PD 0 .IP "\(bu" 2 booting from a knoppix or some other Live-CD (with FSVS on it), .IP "\(bu" 2 partition/format as needed, .IP "\(bu" 2 mount your harddisk partitions below eg. \fC/mnt\fP, .IP "\(bu" 2 and then recovering by .PP .PP .nf $ cd /mnt $ export FSVS_CONF=/etc/fsvs # if non-standard $ export FSVS_WAA=/var/spool/fsvs # if non-standard $ fsvs checkout -o softroot=/mnt .fi .PP .PP If somebody asks really nice I'd possibly even create a \fCrecovery\fP command that deduces the \fCsoftroot\fP parameter from the current working directory. .PP For more information please take a look at \fBUsing an alternate root directory\fP. .SH "Feedback" .PP If you've got any questions, ideas, wishes or other feedback, please tell us in the mailing list \fCusers [at] fsvs.tigris.org\fP. .PP Thank you! .SH "Author" .PP Generated automatically by Doxygen for fsvs from the source code.