Patent ID: 8898378

Claim:
A method for retention management for data stored on a tape, the method comprising: maintaining a block mapping table having entries, the entries including an expiration date for one or more data blocks stored on the tape, wherein the entries comprise at least one entry for a data block of the one or more data blocks that has expired based on the expiration date; sorting the entries of the block mapping table such that the entries are sorted according to date and time in a descending order; rearranging the data blocks on the tape according to the block mapping table, such that the data blocks are stored on the tape according to the data and the time in the descending order; storing the block mapping table; and generating the expiration date by performing operations including: receiving a retention period; receiving a write command for writing a data block to the tape; determining the expiration date for the data block to be written to the tape based on a current time stamp and the retention period; identifying a current block address of the tape where the data block is to be written based on expiration date; and verifying that data blocks with block addresses that have values greater than or equal to the current block address have expired relative to the current time stamp using the block mapping table; writing the data block to the tape if the verifying determines that all data blocks having values greater than or equal to the block address subsequent to the current block address of the tape have expired relative to the current time stamp; updating the block mapping table to include an entry for the data block, in response to writing the data block to the tape; and resorting, after the updating of the block mapping table, the entries of the block mapping table such that the entries are sorted according to the date and the time in the descending order.