Modern** disk drives will automatically reallocate a bad sector to a spare sector when the next write operation to that bad sector occurs. The system error log will record the disk addresses causing I/O errors, and there is a
Bad Block HOWTO to assist in identifying which, if any, files in a filesystem are using that block address.
** Pretty much any HDD pr SSD made in this century.