There are very few files that absolutely must be different between two machines, and need to be regenerated when cloning:
- The host name
- The SSH host keys:
/etc/ssh/ssh_host_*_key* or similar location.
- The random seed:
/var/lib/random-seed or similar location. (
/var/lib/systemd/random-seed on systems using systemd)
Anything else could be identical if you have a bunch of identical machines.
A few files are typically different on machines with different hardware:
/etc/mdadm.conf, and bootloader configuration files (if located in
/etc — some distributions put them in
/boot) if disks are partitioned differently.
/etc/X11/xorg.conf, if present, if the machines have different graphics cards.
- Modules to load or blacklist in
In addition, some network configuration may need to change, in particular:
- If you have static IP addresses, they need to be diversified per machine. The location of IP configuration varies between distribution (e.g.
/etc/network/interfaces on Debian,
/etc/sysconfig/network on Red Hat).
/etc/hosts often contains the host name.
- Mail configuration often contains the host name: check
There's no general answer to “what are the files in
/etc folder (…) are unique for each computer” because the whole purpose of
/etc is to store files that can be customized on each computer. For example, if you have different accounts on different machines, then obviously you can't share the account database — and if you want to be able to share the account database, then you'll end up with the same accounts.
Generally speaking, don't try to share
/etc by default unless you have a set of machines with the same software configuration — same installed software, same accounts, etc. If you do share
/etc, you'll need to blacklist a few files from sharing as indicated above.
If you have machines with different configurations, then whitelist what you synchronize. Treat files in
/etc as distinct on different machines, like files in
/var. Synchronize only the ones that you've decided should apply everywhere.
One possible way to manage synchronization is to keep machine-specific files in a different directory, e.g.
/local/etc, and make symbolic links like
/etc/fstab -> ../local/etc/fstab. This still requires a largely homogeneous set of machines in terms of software as different distributions put files in different locations. Or, conversely, keep only the machine-specific files in
/etc and all generic files elsewhere — but typical distributions don't accommodate this well.
You obviously can't do a live test of the restoration of the system configuration of one system on a different system. To test the restoration of your backups, fire up a virtual machine that emulates the hardware configuration sufficiently well (in particular, with a similar disk layout).