A method of writing data on a storage medium that takes into account a
condition of the storage medium. The method includes receiving data to be
written on a portion of a storage medium and encoding the data based on a
condition of the portion of the storage medium. The encoded data is
written on the portion of the storage medium. A data storage system that
includes a storage medium having defects is also provided. The data
storage system utilizes a coding scheme that comprises coding bit
patterns configured to address the defects on the storage medium.