DIff btrfs snapshots for package installation changes

 To view the changes after a package installation without using Snapper, you need to manually create read-only Btrfs snapshots of your system's root subvolume before and after the dnf transaction, then use the btrfs send -p command with a pipe to see the file differences. A dedicated tool called btrfs-diff may also be available in your distribution's repositories or as a script online. 

Prerequisites

You must be using Btrfs as your root filesystem.

You need sufficient disk space for the snapshots (snapshots are space-efficient as they only store the changes, not full copies).

You'll need root privileges. 

Method 1: Using btrfs send -p

This method leverages Btrfs's incremental backup feature to list changed files. 

Create a pre-installation snapshot: Before running your dnf command, create a read-only snapshot of your root subvolume.

bash

sudo btrfs subvolume snapshot -r / pre_install_snapshot

Install your package: Proceed with your package installation, for example:

bash

sudo dnf install <package_name>

Create a post-installation snapshot: After the installation completes, create another read-only snapshot.

bash

sudo btrfs subvolume snapshot -r / post_install_snapshot

Compare the snapshots: Use btrfs send -p to generate an incremental stream between the two snapshots and pipe it to btrfs receive with a dummy destination, or use a tool that interprets the stream output, to see the list of files that were changed, added, or deleted. The btrfs send command is designed for backup/restore operations, but can be used for this purpose:

bash

sudo btrfs send -p pre_install_snapshot post_install_snapshot | btrfs receive --dump | grep "path"

This command will output a stream of data; the grep "path" part helps filter for file paths in the output, indicating which files were modified.

Clean up: Once you are done, you can delete the snapshots using:

bash

sudo btrfs subvolume delete pre_install_snapshot post_install_snapshot


Popular posts from this blog

Dearpygui resizable table

Fixing DNS Resolution problems with Linux Mint 19