9

I want to create a mirror of my existing Debian server. I modified many files in /etc, and I don't want to redo everything by hand or download huge mirrors. What I thought of doing is

  1. Download a list of all files in /etc
  2. Download a list of all .deb packages installed

Then, on the original server,

  1. Expand all .deb into /tmp/etc1 and see which /etc files they install
  2. ls /tmp/etc1 > /tmp/listOfOrigEtc
  3. ls /tmp/etc > /tmp/listOfEtc
  4. diff /tmp/listOfEtc /tmp/listOfOrigEtc > /tmp/listOfFilesToDownload
  5. Download all new etc files
  6. Using find, see which /etc/ files were modified and download them

Is there a way to do this using a single command?

4
  • 2
    You can compress some of the steps by using something like rsync --dry-run to find changed files. If modification times aren't good enough, you can use rsync --dry-run --checksum.
    – Sparhawk
    Dec 20, 2015 at 4:57
  • 2
    Tip for the future: use etckeeper Dec 20, 2015 at 22:39
  • You could also use find to see what files were modified in e.g. the last 24 hours like so: find /etc -mtime 0 If you want to know how it works: This command works this way because the time since each file was last modified is divided by 24 hours and any remainder is discarded. That means that to match -mtime 0, a file will have to have a modification in the past which is less than 24 hours ago. Incidentally find is extremely powerful and valuable tool to learn (and you even reference it). But if I'm reading your question right I think you could run into problems...
    – Pryftan
    Jan 28, 2018 at 2:45
  • ...because it might be that the timestamp of the modification time in a package is more than 24 hours: depending on when the update is made and when it's pushed to the repos. But perhaps you're not suggesting downloading the packages themselves or there is something else I'm missing. In any event for future reference (though I realise it's quite late) you can use find to search for files based on a specific type. Or as the other comment suggests rsync too (might have been more appropriate in your case even).
    – Pryftan
    Jan 28, 2018 at 2:47

1 Answer 1

8

Install debsums package.

execute debsums as:

debsums --config

It'll list those config files which have been changed from the defaults. Alternatively:

debsums --all

Will show every changed file, including config files.

Rather handy!

Something to remember though... this utility can not be used to discover files which were created separately... only those files which have been modified from the originally installed version.

Creative use of the ctime and mtime file/dir stats can be useful here.

(I've been doing work on this particular topic myself lately, cloning systems)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .