Patent ID: 8806062

Claim:
A method comprising: detecting that a unit of storage from a backup client is to be backed up to a storage system; in response to the detecting, determining whether to compress the unit of storage, wherein the determining comprises identifying a location within the unit of storage, wherein the identifying comprises scanning the unit of storage, wherein the scanning comprises comparing density of data stored in the unit of storage with a specified data density criterion, and the specified data density criterion comprises a ratio of written storage location to unwritten storage locations, determining whether the density of the data stored at the location meets the specified data density criterion prior to attempting to compress the data stored at the location, and calculating an offset from the beginning of the unit of storage to the location, selecting a portion of the unit of storage beginning at the offset, wherein data stored in the portion of the unit of storage comprises the data stored at the location, the portion of the unit of storage is smaller than the unit of storage, and the portion of the unit of storage begins at the offset from the beginning of the unit of storage and ends before the end of the unit of storage, and attempting to compress the data stored in the portion of the unit of storage; and if the attempting is successful for the portion of the unit of storage, compressing the entirety of the unit of storage.