-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added doc for backing up snapshots, LICENSE file
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The MIT License (MIT) | ||
Copyright © 2024 - Aaron N. Josserand Austin, Z Tangerine, LLC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Backing Up LVM Snapshots to a Separate Drive | ||
|
||
## Overview | ||
|
||
Backing up LVM snapshots to a separate drive involves creating a snapshot, optionally mounting it, backing it up with tools like `dd` or `rsync`, and then cleaning up. This process ensures the integrity and security of the data. | ||
|
||
## Steps | ||
|
||
### 1. Create the LVM Snapshot | ||
|
||
Create a snapshot of the logical volume (LV) you want to back up: | ||
|
||
``` | ||
lvcreate -L Size -s -n snapshot_name /dev/vg_name/lv_name | ||
``` | ||
|
||
- `-L Size` specifies the size of the snapshot. | ||
- `-s` indicates that this is a snapshot. | ||
- `-n snapshot_name` sets the name of the snapshot. | ||
- `/dev/vg_name/lv_name` specifies the original LV you're snapshotting. | ||
|
||
### 2. Mount the Snapshot (Optional) | ||
|
||
If necessary, mount the snapshot to access its file system: | ||
|
||
``` | ||
mount /dev/vg_name/snapshot_name /mnt/snapshot_mountpoint | ||
``` | ||
|
||
### 3. Backup the Snapshot | ||
|
||
To back up the snapshot, you can use `dd` or `rsync`: | ||
|
||
- Using `dd` for Image Backup: | ||
|
||
``` | ||
dd if=/dev/vg_name/snapshot_name of=/path/to/backup/location/snapshot_image.img bs=4M | ||
``` | ||
|
||
This command creates a direct image of the snapshot. | ||
|
||
- Using `rsync` for File-based Backup: | ||
|
||
If the snapshot is mounted, synchronize its contents to another drive: | ||
|
||
``` | ||
rsync -aHAX /mnt/snapshot_mountpoint/ /path/to/backup/location/ | ||
``` | ||
|
||
### 4. Unmount and Remove the Snapshot (Optional) | ||
|
||
After the backup, unmount the snapshot if it was mounted, and remove it: | ||
|
||
``` | ||
umount /mnt/snapshot_mountpoint | ||
lvremove /dev/vg_name/snapshot_name | ||
``` | ||
|
||
### 5. Automate the Process | ||
|
||
Consider scripting the entire process to automate the creation, backup, and cleanup of snapshots. | ||
|
||
### 6. Ensure Integrity | ||
|
||
- Verify the backup after creation, using tools like `md5sum` or `sha256sum`. | ||
- Regularly test restoring from backups. | ||
|
||
### 7. Secure the Backup | ||
|
||
- Store the backup in a secure location, preferably with encryption. | ||
- Consider off-site or cloud storage for critical backups. |