File systems – Unix based Mostly…

advertisement
File systems – Unix based
Mostly…
Before We Start…
• What can you conclude from this (recent) lab output?
run:
<t2> Loop iteration number 0
<t1> Loop iteration number 0
<t1> Trying to lock lockA.
<t2> Trying to lock lockA.
<t2> Locked lockA!
<t1> Locked lockA!
<t1> Trying to lock lockB.
<t1> Locked lockB!
<t2> Trying to lock lockB.
<t2> Locked lockB!
Exception in thread "t1" java.nio.channels.OverlappingFileLockException
<t2> Loop iteration number 1
<t2> Trying to lock lockA.
<t2> Locked lockA!
<t2> Trying to lock lockB.
<t2> Locked lockB!
<t2> Loop iteration number 2
<t2> Trying to lock lockA.
<t2> Locked lockA!
<t2> Trying to lock lockB.
<t2> Locked lockB!
<t2> Loop iteration number 3
<t2> Trying to lock lockB.
<t2> Locked lockB!
<t2> Trying to lock lockA.
<t2> Locked lockA!
file contents: Locked lockA and lockB. Locked lockA and lockB. Locked lockA
Definition
• A filesystem is a system (!) that provides a level of abstraction over
persistent storage: hard disks, CDs, flash drives, etc.
• Avoid all those details of the particular I/O subsystem being accessed
• Filesystem’s general goal: setup up logical groups of data organized
into files
• Needs to have an index of locations of these files in actual storage
• Operations:
•
•
•
•
•
•
track available storage,
associate blocks of data with files,
create new files, or open existing files
read files into memory,
update data in files,
delete files
Indexing Methodologies
• Two common methods
• Inodes (I is for Information)
• File Allocation Tables (FAT, usually FAT32)
• Every unix file has
• Inode (block)
• Index blocks (pointers to data blocks and disk sectors)
• data blocks
• Every windoze (DOS) system uses FAT as the indexing mechanism to
files.
Another tangent  : Disks
• A Hard disk contains one or more platters
• Each platter contains physical sectors
• i.e. a “pie slice” of the platter
• Letter A: one Track
• Letter B: one Sector (in blue)
Two kinds of Platters
• Letter C: The Sector’s track (in red)
• Letter D: A Cluster
• The standard sector size was originally 512 bytes
• IBM DASD (Direct Access Storage Device) has512/1024/2048/4096 bytes
Yet Another Tangent: RAID
• Redundant Array of Inexpensive Disks
• Combine multiple disks into one logical unit
• Different schemas (or layouts)
• Goal: RASP == Reliability Availability Serviceability Performance
• Uses Data mirroring and striping
• More than one copy of data
• At the disk level (mirroring)
• Spread out the data so that sequential {bits/bytes/blocks} are on separate
disks (stripe)
• More on RASP…
The Virtual File System: VFS
• Pictoral view of where VFS fits:
• File systems are generally mounted during the boot (IPL) process
• One can mound additional file systems at the VFS layer: memory file
system, proc file system, etc.
The Proc. Filesystem: Procfs
• In the unix world, everything is a file.
• Even processes
• So, the Procfs is a VFS?
• Yes, but it doesn’t consume disk resources (just kernel memory)
• Originally designed to
• hold process information &
• Provide a standard interface to access this information & attributes (via
system utilities)
• Mounted on /proc at boot (ipl) time
• Details are on a process identification (pid) basis, eg /proc/479
• Linux “ps” command we saw earlier uses procfs as does networking.
• Take a look at /proc/self/maps and /proc/interrupts
• https://upload.wikimedia.org/wikipedia/commons/3/30/IO_stack_of_the_Linux_kernel.svg
Download