CS311 - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

CS311

Description:

Tutorial: http://classes.engr.oregonstate.edu/eecs/summer2009 ... Ans: Faster because you go directly to the right inode with no indirection. 5. Lecture 15 ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 9
Provided by: Tuan93
Category:

less

Transcript and Presenter's Notes

Title: CS311


1
CS311 Lecture 16 Outline
  • File System inodes
  • Note These lecture notes are not intended
    replace your notes. This is what I expect your
    notes to already look like, but with more
    explanation as needed.

1
2
inodes
  • Tutorial http//classes.engr.oregonstate.edu/eecs
    /summer2009/cs311/files/misc/inode.pdf
  • Questions on inodes
  • What is in an inode?
  • How does the filesystem assemble all the blocks
    of a file?
  • What is stored in a directory file?

2
3
inodes
  • To see inode number of files ls i
  • File Types that we have studied include
    directory, regular, and symbolic (soft link).
  • inodes are kept in an inode array on disk.
  • Given the inode we just index into the array to
    the one we want.
  • This is possible because inodes are all the same
    size.

Lecture 15
CS311 Operating Systems 1
3
3
4
Links
  • hard links ln existingFile newFile
  • How does the above command relate to inodes?
  • Ans Hard links have the same inode number.
    existingFile and newFile shares one inode.
  • soft linksln -s existingFile newFile2
  • How does the above command relate to inodes?
  • Ans Soft links have their own inode number.
    newFile2 stores the path to existingFile

4
5
Links
  • link count is how many hard links point to them.
    Do not free up this inode until that goes down to
    0.
  • What is an advantage of using soft links?
  • Ans You can link across filesystems
  • What is an advantage of using hard links?
  • Ans Faster because you go directly to the right
    inode with no indirection.

5
6
File system permissions
  • file type regular
  • r - you may read this file
  • w - you may edit this file
  • x - you may execute this file
  • file type directory
  • r - you may list the contents with ls
  • w - you may add a file or rename a file
  • x - you may search this directory for a specific
    filename

6
7
Directory files
  • filename / inode pairs are the only thing in the
    data blocks
  • . and .. are valid filenames and refer to current
    directory and parent directory

7
8
Examples
  • What happens in the filesystem when we try to
    read this file?/nfs/stak/h/hacker/data.txt
  • What do the inodes and datablocks look like after
    these commands?mkdir dirAcd dirAls .. gt
    listing lt- assume dirA is the only file in ..ln
    listing file1ln -s listing file2

8
Write a Comment
User Comments (0)
About PowerShow.com