Stable storage is a method of making a hard drive consistent. Here a hard drive is protected from disk errors and CPU errors in such a way that there is no data corruption in the hard drive. In this method, a write operation is processed fully or no changes are made to the disk in case of an error in the middle of a write operation. In stable storage two identical disks are used for storing data consistently.
Stable write operation: In this operation first data is written to the first disk and then it is read for checking if the write operation was performed correctly. If the write operation wasn’t performed correctly, then the write and read method is performed again and again until the write operation is correctly done. After the write operation is finished in disk 1 then data is written to disk 2 and then read operation is performed in disk 2. Here, in a similar way just like in disk 1, write and read method is performed again and again until the write operation is correctly done. After the data is written and verified in both the disks, the write operation is finished.
Stable read operation: In this operation data is read from the disk 1. If the ECC (Error correcting codes) is not correct then it is read multiple times. If every time the ECC is incorrect, then, data is read from disk 2.
Crash recovery: In this operation, both the disks are scanned. If data is same in both the disks then they are consistent. If a disk has incorrect ECC then data is copied from the other disk drive.