Utility to help manage btrfs snapshots on Slackware linux with elilo UEFI boot
|
|
8 months ago | |
|---|---|---|
| config | 8 months ago | |
| hooks | 8 months ago | |
| packaging | 8 months ago | |
| src | 8 months ago | |
| .gitignore | 8 months ago | |
| README.md | 8 months ago | |
| setup.py | 8 months ago | |
| snap-slack.info | 1 year ago |
Snap-Slack is a Python-based utility for managing Btrfs snapshots on Slackware Linux. It provides functionality to create snapshots, manage existing snapshots, clean up old snapshots, and adopt snapshots as the new root subvolume. The tool also integrates with the Elilo bootloader, updating the configuration automatically to include snapshots.
snap-slack.SlackBuild script and associated filesRun the SlackBuild script:
./snap-slack.SlackBuild
Install the package:
sudo installpkg /tmp/snap-slack-2.0-x86_64-1_SBo.txz
This will install the script to /usr/bin/snap-slack and place the configuration file at /etc/snap-slack/config.toml.
The script reads its configuration from /etc/snap-slack/config.toml. You should edit this file to match your system's settings before using snap-slack.
Here is an explanation of the configuration parameters:
snapshot_dir: Directory where Btrfs snapshots are stored (e.g., /.snapshots)snapshot_prefix: Prefix for snapshot names (e.g., snapshot-)btrfs_mount_point: Mount point for the Btrfs volume (usually /)root_subvolume: Name of the current root subvolume (usually @ in Slackware)retention_days: Number of days to retain snapshots before automatic deletiontype: Specify either elilo or grub depending on your system's bootloaderelilo_conf: Path to elilo.conf (e.g., /boot/efi/EFI/Slackware/elilo.conf)root_partition: Device name for the root partition (e.g., /dev/sda2)extra_boot_options: Additional kernel parameters (e.g., quiet splash)use_custom_file: Set to true to use a custom file in /etc/grub.d/ (recommended)custom_entries_file: Path to the custom file (e.g., /etc/grub.d/60_snap-slack)config_file: Path to GRUB configuration file (e.g., /boot/grub/grub.cfg)root_partition: Device name for the root partition (e.g., /dev/sda2)kernel_path: Path to the kernel image (e.g., /boot/vmlinuz)initrd_path: Path to the initrd image (e.g., /boot/initrd.gz)extra_boot_options: Additional kernel parameters (e.g., quiet splash)boot_dir: Path to the boot directory (e.g., /boot)hostname: System hostname (used for snapshot descriptions)Once installed and configured, you can use the snap-slack command to manage Btrfs snapshots and integrate them with Elilo.
Before using snap-slack, verify that your system is properly configured:
snap-slack verify
This will check that your system has Btrfs installed, the root filesystem is Btrfs, and other necessary prerequisites are met.
To create a new Btrfs snapshot of the root subvolume:
snap-slack create
The script will:
elilo.conf bootloader configurationTo list all existing snapshots with details:
snap-slack list
This will display a table of all snapshots, their creation dates, and ages.
To manage existing snapshots (clean up old snapshots and update elilo.conf):
snap-slack manage
This will:
elilo.conf has entries for all valid snapshotsTo configure a specific snapshot for booting:
snap-slack boot --snapshot snapshot-20240424-123456
This will ensure that the snapshot is properly configured in elilo.conf for booting.
If you want to adopt a specific snapshot as the new root subvolume (rollback to a previous state):
snap-slack adopt --snapshot snapshot-20240424-123456
This will:
When you want to boot into a snapshot to test it before adoption:
snap-slack listsnap-slack boot --snapshot <snapshot-name>If you want to permanently make a snapshot your new root filesystem:
snap-slack adopt --snapshot <snapshot-name>If something goes wrong during the adoption process:
# Create a snapshot before upgrading
snap-slack create
# Perform your upgrade
slackpkg update
slackpkg upgrade-all
Add this to your crontab to create a weekly snapshot:
0 2 * * 0 /usr/bin/snap-slack create
0 3 * * 0 /usr/bin/snap-slack manage
Snap-slack logs all operations to /var/log/snap-slack.log. Check this file for troubleshooting if you encounter any issues.
adopt operation requires a reboot to take effectIf you'd like to contribute to Snap-Slack, feel free to open an issue or submit a pull request on the project's repository.
This project is licensed under the MIT License.
For help or support, feel free to open an issue on the repository.