Linux – Diff Entire Linux Systems

diff()linuxvirtualbox

I have a base Linux system installed. I want to run a very large and complex third-party script that will make many changes to various parts of the entire system. These changes will include adding new files, modifying existing files, and removing existing files. Once the script is complete, I will have a modified system. The modifications will be broad and substantial.

I want some sort of report on all the files that have been added, removed, or modified and a line-by-line analysis of the modifications. Something like the output of a file diff tool would be great.

I assume I need to make some sort of snapshot before running the script and a second snapshot after. I assume then I would feed those snapshots into some sort of diff or diff-like tool.

Does anyone know what tools to use and how to diff an entire system?

I am using Virtualbox which does have a differencing images feature, though I don't know if I can adapt it to this purpose. Moreover, I'd prefer a more generic solution if possible.

Best Answer

I think your idea is not far from a solution. To outline a possible way: I am using rsnapshot for backups. It creates a directory (backup-)structure of all or of a subset of your files with entry points of (e.g.) /backup/hourly.1/... and /backup/hourly.0/..., where each branch carries the whole data, but using (hard-)links for files where no changes have been done. Doing a recursive ls or find on both structures and comparing the (sorted, in case of find) output will show the missing files, and inspecting the link-count (in ls -l it would be the second column) will show new files (which have a link count 1). For details of changes in the files you can (for the identified files) use ordinary diff tools. As said this is an outline, will need some work to implement, and may have non-apparent quirks, so take that proposal with a grain of salt

Related Question