logoalt Hacker News

M95Dyesterday at 10:53 AM1 replyview on HN

FAT can be made tolerant form the driver just like a journaled FS:

  1) mark blocks allocated in first FAT
  If a crash occurs here, then data written is incomplete, so write FAT1 with data from FAT2 discarding all changes.
  
  2) write data in sectors
  If a crash occurs here, same as before, keep old file size.
  
  3) update file size in the directory
  This step is atomic - it's just one sector to update. If a crash occurs here (file size matches FAT1), copy FAT1 to FAT2 and keep the new file size.
  
  4) mark blocks allocated in the second FAT
  If a crash occurs here, write is complete, just calculate and update free space.
  
  5) update free space

Replies

ale42yesterday at 12:02 PM

Is this something the FAT driver is Linux can do?

show 1 reply