formatForBackup - Formats a storage-device for use in a backup-strategy.
formatForBackup.bash [OPTIONS] device-name
Formats the specified storage-device with a Btrfs-filesystem on a LUKS storage-volume.
• |
The use of Btrfs permits snapshots to be used to record previous versions of the backup. | ||
• |
The use of LUKS enables the whole device to be encrypted to safe-guard the user’s data should the storage-device be lost. | ||
• |
device-name can be a whole storage-device or merely a partition of one. |
If the specified path is
neither a block device nor absolute, then a prefix of
"/dev/" will be assumed.
CAVEAT: all data previously recorded on the referenced
device/partition, will be lost.
• |
N.B.: this executable doesn’t perform the backup; the product’s makefile defines this role. |
-v |
Verbose: produces additional output where available. |
-d device-name
The name of the device to which
the decrypted storage-volume should be temporarily mapped
(under /dev/mapper/); this value has little
significance.
Default "decrypted".
-f filesystem-label
The label to be assigned to the
new filesystem. This will affect the directory under which
the OS automatically mounts the filesystem.
Default "Backup".
-c checksum-algorithm
The checksum-algorithm used by
the new filesystem.
See man -s5 btrfs for options.
Default "blake2".
-u user-name
The name of the user who owns the backup & this filesystem.
Generic Program-information
-? |
Displays help & then exits. |
0 on success, & >0 if an error occurs.
$
formatForBackup.bash -v sdb # The typical scenario
where /dev/sda contains the OS & the device-name
"sdb" is then assigned to the first USB
storage-device inserted.
[sudo] password for root:
WARNING!
========
This will overwrite data on /dev/sdb irrevocably.
Are you sure?
(Type ’yes’ in capital letters): YES
Enter passphrase for /dev/sdb:
Verify passphrase:
Enter passphrase for /dev/sdb:
btrfs-progs v5.14
See http://btrfs.wiki.kernel.org for more information.
Label: Backup
UUID: 98ba67cf-31c7-4cb9-ba09-269a1464eaa4
Node size: 16384
Sector size: 4096
Filesystem size: 7.45GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: no
Zoned device: no
Incompat features: extref, skinny-metadata
Runtime features:
Checksum: blake2
Number of devices: 1
Devices:
ID SIZE PATH
1 7.45GiB /dev/mapper/decrypted
N.B.: the root-password is requested, then the encryption-passphrase is requested several times.
On successful termination, the formatted device will be unmounted & can be safely removed.
When next
connected, the specified symmetric-encryption passphrase
will be requested.
CAVEAT: depending on your desktop-environment, a
keyring-password may also be requested to enable the
encryption-passphrase to be cached.
Once decrypted & mounted, the product’s
makefile can be installed to implement the
backup-process, & this requires a local
"exclusions.txt" file containing globs
matching those files which the user doesn’t
want included in the backup.
Written by Dr. Alistair Ward.
REPORTING
BUGS
Report bugs to
<flashback@functionalley.com>.
Copyright © 2023 Dr. Alistair Ward
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 <https://www.gnu.org/licenses/>.
• |
<https://functionalley.com/Storage/flashback.html>. | ||
• |
<https://github.com/functionalley/Flashback>. | ||
• |
<https://en.wikipedia.org/wiki/Btrfs>. | ||
• |
<https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup>. |