File System Crash Consistency Flashcards

1
Q

File system data structures must _______

A

persist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

File system data structures are stored in _______ devices to survive for a long time

A

storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The main challenge is to _____ persistent data structures in spite of _________ and _____ failures

A

update, crashes, power

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In a scenario with 3 writes to data block, inode, and data bitmap with only 1 write succeeding, what happens of only the data block is written to disk?

A

This is as if the write did not happen because the inode was never updated -> nothing to worry about

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In a scenario with 3 writes to data block, inode, and data bitmap with only 1 write succeeding, what happens if only the inode is updated?

A

The inode points to a new data block, but there’s no actual data there -> inode reads garbage data (inconsistency)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In a scenario with 3 writes to data block, inode, and data bitmap with only 1 write succeeding, what happens if only the bitmap is written?

A

Bitmap indicates data block is used, but nothing points to it -> space leak as data block will never be used (inconsistency)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In a scenario with 3 writes to data block, inode, and data bitmap with 2 writes succeeding, what happens of the inode and bitmap are written?

A

The data block is not updated -> following inode leads to garbage data (inconsistency)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In a scenario with 3 writes to data block, inode, and data bitmap with 2 writes succeeding, what happens when the inode and data block are written?

A

Allocation of data block not recorded -> data block may get re-allocated (data corruption)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In a scenario with 3 writes to data block, inode, and data bitmap with 2 writes succeeding, what happens when the bitmap and data block are written?

A

We have no idea which file the new allocated data block belong to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The goal of the crash consistency problem is to move the file system from one consistent state to another ________

A

atomically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are 2 challenges of the crash consistency problem?

A
  1. Disk only commits one write at a time (but we need to do many)
  2. Crashes a power failures may happen between writes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

One solution to the crash consistency problem is the file system _______

A

checker

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The fsck is a _____ used for finding inconsistencies in file system and ____ them

A

tool, fix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What structures are checked by fsck?

A

superblock, free blocks, inode state, inode pointers, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

fsck cannot fix all problems because a file system may look ________ but the inode points to _______

A

consistent, garbage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The real goal of the fsck is to make sure the file system ________ is consistent

A

metadata

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

fsck performs _______ checks on the superblock, like making sure file system size > number of _____

A

sanity, blocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How does fsck check free blocks?

A

Scan inodes, direct, and indirect blocks to learn which blocks are allocated, then cross check with the bitmaps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

If the fsck suspects the inode state is corrupted after a ______ check, it clears it as it is not an easy fix

A

sanity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does fsck check for inode links and how does it do it?

A

fsck checks the link count. It does it by scanning the entire directory tree to build up new link counts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

fsck checks for duplicates by checking if 2 different _______ point to the same ____

A

inodes, block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

fsck checks for bad blocks by scanning through the list of _______ and checking for bad pointers i.e. pointer pointing to block number outside ______ size

A

pointers, partition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How does fsck check directories?

A

fsck does integrity checks. Make sure . and .. are first 2 entries and each inode referred to in the directory is allocated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

fsck does not know about the _______ of normal files

A

content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

fsck needs detailed _______ of the file system

A

detailed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

fsck is an ________ tool and is typically invoked at ______

A

offline, boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is the main disadvantage of fsck?

A

It is too slow as it scans the entire disk

28
Q

Another solution to crash consistency problem is __________

A

journaling

29
Q

In journaling, we note down “what to do” before actually doing the ________

A

updates

30
Q

Journaling is also known as _______-______ logging

A

write-ahead

31
Q

In journaling, any permanent change must be recorded in the ____ first

A

log

32
Q

In journaling, the log is also stored _______ on disk

A

permanently

33
Q

In journaling, if there is a ______, we look at the log upon reboot and try again

A

crash

34
Q

Journaling makes more work during _______, but reduces work during ______ ________

A

updates, crash recovery

35
Q

The journal occupies space within the _______

A

partition

36
Q

In data journaling, update content is wrapped in a _________

A

transaction

37
Q

What is a transaction?

A

Updates that must all happen atomically or not

38
Q

Transactions are also called _______ _______

A

physical logging

39
Q

What are the 5 components in a transaction?

A

TxB, I[v], B[v], Db, TxE

40
Q

In data journaling, both the TxB and TxE contains the __________ ID

A

transaction

41
Q

In journaling, a _______ is when the transaction is safely logged and the updates actually happen on disk

A

checkpoint

42
Q

In our first naive procedure for write(), what 2 steps do we have?

A
  1. Journal write (transaction data to log)

2. Checkpoint (write updates to final location)

43
Q

Our first naive procedure for write() with 2 steps doesn’t work because our transaction data may be written to the…

A

out of order

44
Q

What are 3 ways to write a transaction to log?

A
  1. One request at a time (for a total of 5 writes)
  2. One big write containing all the writes
  3. Two writes. One for everything except TxE, and one for TxE
45
Q

Writing the transaction one request at a time 5 times is ___

A

slow

46
Q

Writing the transaction with one big request is _______ because the writes finish in any order and items between TxB and TxE could be missing, but seems fine to the system after a crash.

A

unsafe

47
Q

Writing the transaction with 2 requests depends on the _______ guarantee of the storage device. TxE has to be ________than a fixed size

A

atomicity, smaller

48
Q

In our second naive procedure for write(), what 3 steps do we have?

A

1 Journal Write (everything except TxE)

  1. Journal Commit (TxE)
  2. Checkpoint
49
Q

How do we recover when a crash happens before the transaction is written?

A

Skip the pending updates

50
Q

When a crash happens after a transaction is written bu before the checkpoint, we scan all _______ transactions then checkpoint them

A

committed

51
Q

When a crash happens during checkpointing, we ____ the checkpointing process

A

redo

52
Q

If we modify two files in the same directory, the same block gets updated twice using two __________, leading to ________ writes

A

transactions, excessive

53
Q

To prevent the same block getting updated twice, we can _______ journal writes into a ________ transaction

A

buffer, global

54
Q

When batching log writes, we mark relevant block as _____, add them to a list of blocks to write for the current ___________, then commit the global transaction after a _________

A

dirty, transaction, timeout

55
Q

What two problems arise when the log becomes full?

A
  1. Long recovery time

2. No further transactions can be committed to the disk

56
Q

To prevent the log from becoming full, we treat the log as a ________ structure and reuse journal space once the transaction has been __________

A

circular, checkpointed

57
Q

The journal superblock marks the _____ and ______ transactions in the log

A

oldest, newest

58
Q

What four steps do we have in the final write procedure with journaling?

A
  1. Journal Write (except TxE)
  2. Journal Commit
  3. Checkpoint
  4. Free (mark log space as free by updating journal superblock)
59
Q

A problem of data journaling is that every data block is written to disk _____-

A

twice

60
Q

In metadata journaling, we only log changes to _______

A

metadata

61
Q

Metadata journaling is also known as _______ ______

A

ordered journaling

62
Q

What are the 2 alternatives to picking when to write data blocks to disk during metadata journaling?

A
  1. Write data after transaction

2. Write data to disk before transaction

63
Q

In metadata journaling, if we write data to disk after the transaction, the inode may end up pointing to ________ _____ if the data write fails

A

garbage data

64
Q

What are the 5 steps in the write protocol with metadata journaling?

A
  1. Data Write )write data to final location)
  2. Journal metadata write (no TxE)
  3. Journal Commit
  4. Checkpoint metadata
  5. Free
65
Q

Block reuse can cause data corruption when say block 1000 is updated, deleted, then created into something else. If a crash occurs, the newly created directory would be ______ instead of the old thing that was at block 1000

A

modified

66
Q

On solution to the problem of block reuse is adding a ______ _______ to the journal

A

revoke record

67
Q

The revoke record prevents data from being __________ during journal replay

A

replayed