Assume, I have a system with all the packages installed, which I want, and all configuration files set up as desired. However, the files on the file system could have become corrupted or missing due to some mistake in the past or hardware error. The corrupted files would be replace if the package in question was reinstalled. Such a situation is described elsewhere
Can I safely run
aptitude reinstall ?installed
to get a fresh version of my system?
A good way to deal with file corruption is to use `debsums' (see these instructions, and also this great answer), though they're starting with a non-booting system) which will discover which files are corrupted; then you can reinstall just those packages.
Your reinstall command is safe, but it's not guaranteed to fix everything that might have been caused by a hardware error.
You might also like to force a fsck or run a
badblocks
scan. You can do both of those from inside the disk utility.I would not suggest to do so, because it could be a very long and for the most part un-useful operation. Moreover configuration files and personal configuration files are not involved in the simple reinstall, and the problem could be just there.
It is better to try to determine which packages have problems and reinstall only these packages.