Operating Systems 2019W Lecture 10: Difference between revisions

From Soma-notes
 
Line 5: Line 5:
==Readings==
==Readings==


There are a number of chapters in the textbook related to filesystems & block devices.  You are not responsible for all of this material, but you may benefit from looking through the following for key concepts covered in class - particularly if you are confused about some of the concepts.


* [http://pages.cs.wisc.edu/~remzi/OSTEP/file-devices.pdf I/O Devices]
* [http://pages.cs.wisc.edu/~remzi/OSTEP/file-disks.pdf Hard disk drives]
* [http://pages.cs.wisc.edu/~remzi/OSTEP/file-intro.pdf Files and Directories]
* [http://pages.cs.wisc.edu/~remzi/OSTEP/file-implementation.pdf Filesystem implementation]
* [http://pages.cs.wisc.edu/~remzi/OSTEP/file-journaling.pdf FSCK and Journaling]


==Notes==
==Notes==

Latest revision as of 00:48, 7 February 2019

Video

The video for the lecture given on February 6, 2019 is now available.

Readings

There are a number of chapters in the textbook related to filesystems & block devices. You are not responsible for all of this material, but you may benefit from looking through the following for key concepts covered in class - particularly if you are confused about some of the concepts.

Notes

In Class

Lecture 10
----------

What is a filesystem?
 - hierarchy of files?
 - may or may not have underlying storage
 - more formally, hierarchical key-value store
 
Really, from the kernel's perspective, it is
 - functions that can be called to implement filesystem-related system calls

This abstraction is knows as the "virtual filesystem", VFS


In tutorial 4, you're making and manipulating filesystems...stored in block devices


Examples:
/proc      proc filesystem
/sys       sys filesystem
/          ext4 filesystem
/boot/efi  vfat filesystem
/boot      ext2 filesystem
...

/boot/efi/UBUNTU  <-- what filesystem is this on?

mounting is how we associate a subtree (directory) with a filesystem


BAD IDEA

mount /dev/sdc1 /
(assume /dev/sdc is a USB stick)


local, persistent filesystems are normally associated with block devices
 - the filesystem is what allows us to use a block device to store files

a block device is a persistent "array" of "blocks"
 - blocks are fixed size (i.e. 4K)
 - accessed by index

From a storage perspective, a filesystem is a way of storing a file hierarchy on a block device (i.e., in blocks accessed by indices)



So is a filesystem just a tree?
 - kind of

Goals for an on-disk filesystem structure
 - fault tolerant
 - reliable
 - high performance
    - takes the characteristics of the block device into account

Normally, block devices (whether hard drives or SSDs)
 - sequential access is faster than random access


High level action on an open system call

* process makes open system call, e.g. open("/home/student/foo.txt", ...)
* kernel figures out what filesystem /home/student/foo.txt is on
  (ext4 from /dev/sda2 mounted on /home)
* kernel calls ext4 open function for /dev/sda2, gives it /student/foo
* ext4 looks at /dev/sda2, figures out where the blocks are for /student/foo
* ext4 stores this info in file structure, returns
   <-- what a file descriptor refers to