advanced unix
play

Advanced UNIX CIS 218 Advanced UNIX Director ies again CIS 218 - PowerPoint PPT Presentation

Advanced UNIX CIS 218 Advanced UNIX Director ies again CIS 218 Advanced UNIX 1 Directory Implementation The starting (root) directory of each filesystem is created by formatting . A UNIX directory is a file : it has an owner, group


  1. Advanced UNIX CIS 218 Advanced UNIX Director ies again … CIS 218 Advanced UNIX 1

  2. Directory Implementation  The starting (root) directory of each filesystem is created by formatting .  A UNIX directory is a file : – it has an owner, group owner, size, access permissions, etc. – many file operations can be used on directories  Differences: – A directory is a special system file – UNIXs have special directory operations e.g. mkdir, rmdir CIS 218 Advanced UNIX 2

  3. Structure  A directory ‘file’ is a sequence of lines; each line holds an i-node number and a file name.  First directory (root) in each file system is automatically created when filesystem is formatted. :  The data is stored as binary, so we cannot 120 “fred.html” simply use cat to view it 207 “abc” – some older UNIXs allow: $ od -c dir-name 135 “bookmark.c” : CIS 218 Advanced UNIX 3

  4. UNIX Memory Structure disk drive partition partition partition file system super boot I-list Data blocks for files, dirs, etc. block block . . . . . . . . i-node i-node i-node i-node . CIS 218 Advanced UNIX 4

  5. File System in More Detail Data Blocks i-list data data dir blk data dir blk i-node i-node i-node : no filename i-node : : number no filename : CIS 218 Advanced UNIX 5

  6.  Boot block : a hardware specific program that is called automatically to load UNIX at system startup time.  Super block -- it contains two lists: – a chain of free data block numbers – a chain of free i-node numbers CIS 218 Advanced UNIX 6

  7. “Soft” ln and unlinking  Meaning of: ln – s (“abc”, “xyz”)  Create directory xyz point to abc (indirect pointer)  rm linkname clears the directory record – usually means that the i-node number is set to 0 : – the file may not be affected  The i-node is only deleted when the last link to it is removed; the data block for the file is : also deleted (reclaimed). continued CIS 218 Advanced UNIX 7

  8. “Hard” ln and unlinking  Meaning of: ln (“abc”, “xyz”)  Create directory xyz point to same inode as abc (direct pointer)  rm linkname clears the directory record – the file not be affected as long as other directory entries remain  The i-node is only deleted when the last link to it is removed; the data block for the file is also deleted (reclaimed). CIS 218 Advanced UNIX 8

  9. Subdirectory Creation  mkdir foo causes: – the creation of a foo directory file and an i- node for it – an i-node number and name are added to the parent directory file : 120 “fred.html” 207 “abc” 135 “bookmark.c” 201 “foo” : CIS 218 Advanced UNIX 9

  10. 5. “ . ” and “ .. ”  “ . ” and “ .. ” are stored as ordinary file names with i-node numbers pointing to the correct directory files. ben  Example: book memos continued CIS 218 Advanced UNIX 10

  11. In detail: Directory ben 123 “.” 247 “..” “ book ” 260 “ memos ” 401 Directory book Directory memos 260 “.” 401 “.” 123 “..” 123 “..” 56 “ chap 1” 80 “kh” 6 0 567 “ chap 2” 81 “kd” 00 590 “chap 3” 590 “mw” 77 CIS 218 Advanced UNIX 11

  12.  “ . ” and “ .. ” entries are added automatically  mode must include execute permissions so the user(s) can use cd . 0755 e.g. CIS 218 Advanced UNIX 12

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend