backup.8 (3844B)
1 .\" Copyright (C) 2023, 2024 Vincent Forest (vaplv@posteo.net) 2 .\" 3 .\" This program is free software: you can redistribute it and/or modify 4 .\" it under the terms of the GNU General Public License as published by 5 .\" the Free Software Foundation, either version 3 of the License, or 6 .\" (at your option) any later version. 7 .\" 8 .\" This program is distributed in the hope that it will be useful, 9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of 10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 .\" GNU General Public License for more details. 12 .\" 13 .\" You should have received a copy of the GNU General Public License 14 .\" along with this program. If not, see <http://www.gnu.org/licenses/>. 15 .Dd December 1, 2023 16 .Dt BACKUP 8 17 .Os 18 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 19 .Sh NAME 20 .Nm backup 21 .Nd file system backup 22 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 23 .Sh SYNOPSIS 24 .Nm 25 .Ar backup_dir 26 .Ar files_to_backup 27 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 28 .Sh DESCRIPTION 29 .Nm 30 saves the file system or mount point referenced by the 31 .Ar files_to_backup 32 argument to the 33 .Ar backup_dir 34 directory. 35 It is a shell script that relies on the 36 .Xr dump 8 37 utility to provide an incremental backup strategy based on the Tower of 38 Hanoi sequence. 39 .Pp 40 A complete backup cycle is built around 3 consecutive Tower of Hanoi 41 sequences. 42 The first sequence begins with a full backup 43 .Pq level 0 . 44 The other two sequences begin with an incremental backup of level 1. 45 This is the only level that will have several files 46 .Pq in this case 2 47 during a complete backup cycle. 48 .Pp 49 The dump levels of a complete backup cycle are as follows: 50 .Bd -literal -offset Ds 51 0 -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 52 1a -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 53 1b -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 0 54 .Ed 55 .Pp 56 The name of the file in which a backup is stored begins with 57 .Qq backup 58 followed by the corresponding level number. 59 Level 0 adds an underscore 60 .Sq _ 61 followed by the backup date in ISO 8601 format. 62 This prevents a 63 previous level 0 from being overwritten. 64 It is a simple way of keeping track of backup history. 65 It is left to the administrator to archive level 0 backups according to 66 his or her policy. 67 Finally, all files end with the 68 .Qq .dump 69 extension. 70 .Pp 71 A text file corresponding to each backup is also generated to store 72 backup information, such as backup dates and backup files. 73 These files adopt the same naming convention as the backup files, except 74 that the extension is 75 .Qq .txt 76 instead of 77 .Qq .dump . 78 .Pp 79 To keep track of the status of the backup cycle, the identifiers 80 of the next backup file are stored in the file defined by the 81 .Ev NEXTBACKUP 82 environment variable. 83 The dump level between 84 .Bq 0, 9 85 is listed first, followed by a space and the index of the Hanoi Tower 86 sequence number 87 .Pq between Bq 0, 2 . 88 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 89 .Sh ENVIRONMENT 90 .Bl -tag -width Ds 91 .It Ev NEXTBACKUP 92 File in which identifiers for the next backup file are stored. 93 Default is 94 .Pa /etc/nextbackup . 95 .El 96 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 97 .Sh EXIT STATUS 98 .Ex -std 99 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 100 .Sh EXAMPLES 101 Daily backup of partition 102 .Pa /dev/sda3 103 in 104 .Pa /mnt/storage . 105 Note that in this example, backups are performed manually, but that 106 .Xr cron 8 107 could be used to automate the process: 108 .Bd -literal -offset Ds 109 backup /mnt/storage /dev/sda3 # Day 1 -> Level 0 110 backup /mnt/storage /dev/sda3 # Day 2 -> level 3 111 backup /mnt/storage /dev/sda3 # Day 3 -> level 2 112 backup /mnt/storage /dev/sda3 # Day 4 -> level 5 113 \&... 114 .Ed 115 .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 116 .Sh SEE ALSO 117 .Xr cron 8 , 118 .Xr dump 8