04 1 Ufs
04 1 Ufs
Jan Schaumann
jschauma@stevens.edu
https://stevens.netmeister.org/631/
CS631 - Advanced Programming in the UNIX Environment
2
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
• on each logical partition you may create a file system containing the cylinder groups
4
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
• each cylinder group contains a list of inodes (i-list) as well as the actual directory-
and data blocks
5
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
6
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
#123
• data blocks containing the actual data (i.e., contents of the file) are referenced from
the inode
7
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
#123
#123
8
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
#123
#123
#123
10
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
• ".." --
Jan Schaumann the parent directory 11
2020-09-17
CS631 - Advanced Programming in the UNIX Environment
12
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Inodes
• The inode number in a directory entry must point to an inode on the same file system
(no hardlinks across filesystems).
13
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Inodes
• The inode number in a directory entry must point to an inode on the same file system
(no hardlinks across filesystems).
• The inode contains most of the information found in the struct stat.
• Every inode has a link count (st_nlink): it shows how many “things” point to this
inode. Only if this link count is 0 (and no process has the file open) are the data
blocks freed.
14
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Inodes
• To move a file within a single filesystem, we can just ”move” the directory entry
(actually done by creating a new entry, and deleting the old one).
15
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Inodes
• To move a file within a single filesystem, we can just ”move” the directory entry
(actually done by creating a new entry, and deleting the old one).
16
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Inodes
• To move a file within a single filesystem, we can just ”move” the directory entry
(actually done by creating a new entry, and deleting the old one).
17
Jan Schaumann 2020-09-17
CS631 - Advanced Programming in the UNIX Environment
Visualizing the Unix Filesystem helps us understand the concept of hard links, what
directories "look like", and how operations on a directory are independent of the files
and their data.
Coming up: creating, removing, and renaming links (hard and symbolic)
18
Jan Schaumann 2020-09-17