Understanding Filesystem Consistency and Journaling for Data Reliability, Study notes of Operating Systems

The importance of filesystem consistency and the role of journaling in ensuring data reliability. It covers the concept of filesystem consistency, the challenges of maintaining it, and the use of fsck for checking and repairing filesystems. The document also introduces journaling as a solution to these challenges and explains how it works. It highlights the benefits of journaling, such as faster fsck and improved data recovery, and compares it to unjournaled filesystems.

Typology: Study notes

2012/2013

Uploaded on 04/23/2013

ashalata
ashalata 🇮🇳

3.8

(18)

106 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
If it fails, we lose "memory".
This is very bad.
The filesystem is a computer's true "memory"
Robustness against power failures.
Reliability against disk failures.
Access from different machines.
Usability in virtual environments.
Filesystem challenges
Tuesday, December 08, 2009
1:32 PM
Storage Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Understanding Filesystem Consistency and Journaling for Data Reliability and more Study notes Operating Systems in PDF only on Docsity!

If it fails, we lose "memory". This is very bad. The filesystem is a computer's true "memory" Robustness against power failures. Reliability against disk failures. Access from different machines. Usability in virtual environments. Filesystem challenges Filesystem challenges Tuesday, December 08, 2009 1:32 PM Docsity.com

blocks/inodes marked used are used. blocks/inodes marked free are free. inodes point to valid data blocks. directories point to valid inodes. every directory contains. and .. A filesystem is consistent if blocks get out of date … which can contain inodes, used bitvectors, data, directories... Case in point: what happens if the power fails? The concept of consistency Tuesday, December 07, 2010 10:57 AM Docsity.com

Doesn't repair all problems; just restores a consistent state. Takes a long time on large (terabyte) filesystems. Problems with fsck One answer: journaling Problems with fsck Tuesday, December 07, 2010 11:11 AM Docsity.com

Disk writes are "scheduled" by update. It takes a long time to get around to writing. So, there is a relatively long time in which updates are in memory but not on disk. So there is a long window of vulnerability, in which pulling the plug loses information. An unjournaled filesystem (e.g. ext2): The journal contains block contents to write later. The journal is a set of contiguous sectors (a ring queue). The journal is treated as a persistent cache: it stores block contents until they can be written to their proper places. In a journaled filesystem (e.g., ext3): Journaling Tuesday, December 07, 2010 11:13 AM Docsity.com

Tuesday, November 27, 2012 4:46 PM Docsity.com

The dirty trick: keep track of when the journal represents a consistent state. Then, if power fails, one can write journal to the last consistency point, and the filesystem will be consistent. No fsck needed. Consistency Tuesday, November 27, 2012 4:48 PM Docsity.com

Unjournaled Journaled read is fast read requires checking journal write is lazy journal write is aggressive; journal flush is lazy fsck takes forever fsck flushes the journal, and then deals with any further problems; consistency is (usually) preserved Comparison between journaled and unjournaled filesystems Tuesday, December 07, 2010 11:19 AM Docsity.com

put it into transaction queue hash it into transaction hash write hash and block to disk If we want to flush a dirty page, use hash find position in trans queue read from there. If we want to get a dirty page, read trans block write to real location of block erase transaction entry Eventually, we'll flush the queue: to get a journaled filesystem, we layer on top of a regular disk driver. very important: Picture of journaling (no raid) Wednesday, November 30, 2005 3:09 PM Docsity.com

transaction queue tracks which blocks were pending for modification. it is written quickly because it's in the center of the disk => low seek time. because of this, we know where problems may arise during power failures. so after a power failure, we merely have to play back the transaction queue and all is well! (sort of!) There may be problems, but we'll fairly well know which blocks are potentially stale! These will be the blocks after the last consistency mark in the journal. Benefits of journaling Benefits of journaling Wednesday, November 29, 2006 5:22 PM Docsity.com

If journaling is so cool, why not use it for everything? Maintain a dynamic journal of which blocks go where. Don't implement the actual filesystem that the journal depicts! Transactional filesystems Transactional filesystems Tuesday, December 07, 2010 11:38 AM Docsity.com

transactions, lazily clean up changes to actual disk locations during low-load periods. ○ Can "roll back" disk image in time by forgetting transactions! Properties of transactional systems Docsity.com

End of lecture on 11/27/ Tuesday, November 27, 2012 5:05 PM Docsity.com