week 6 - L6 - File System Flashcards
catching
- what does it improve?
- example of when Linux uses it
- what’s it used for?
- what does Linux keep in memory?
- Linux relies heavily on caching to improve performance
o For example when it tries to retrive a file from the file system
- Linux keeps in memory:
o Recently accessed disk blocks
o The inode of each open file in the file system
o A cache of recent name to inode mappings
o A directory offset cache
Disk encryption
- what is it
- what does it use to do it
- why is it used
- what is Full Disk Encryption (FDE)
- which areas are not encrypted
- Disk encryption is a technology which protects information by converting it into unreadable code that cannot be deciphered easily by unauthorised people
- Disk encryption uses disk encryption software or hardware to encrypt every bit of data that goes on a disk or disk volume
- It’s used to prevent unauthorised access to data storage
- Expressions full disk encryption (FDE) or whole disk encryption signify the everything on disk is encrypted
o But the master boot record MBR or similar area of bootable disk, with code that starts the operating system loading sequence is not encrypted
Logical volume management LVM
- where can a file system be?
- what does it need to spam on different hard drives?
Logical volume management LVM
- A filesystem can be made directly on top of a partition, or it can span over several partitions, possibly on different hard drives, with the aid of an intermediate logical volume management LVM layer
- LVM introduces a greater level of flexibility into storage management than partitioning alone
Device mapper
- what does it create? out of what?
- what does it map?
- In Linux the device mapper creates new block (storage) devices out of other nodes
- It is a framework provided by the Linux kernel for mapping physical block devices onto higher-level virtual block devices
In memory data structures
- what does the kernel maintin?
- what do the entries contain?
- what table does each process contain(not the page table)? and what does it describe?
- what do these entries point to
- what mark does a process have?
- The kernel maintains a system-wide table that describes open files
- Each entry contains
o The read/write MARK which indicates where the next data block is to be read
o A pointer to an entry in the active inode table, so that the access times can be modified efficiently - Each process maintains a user file table that describes the files opened by the process
o Entries in the user file table point to system-wide file table
- A process can have its own private read/write mark or it can share a read/write mark as it’s the case when a new process is created via fork)
Mount table
- what is it?
- what do the entries contain?
- WHAT DOES THE KERNEL DO WHEN TRANSLATING A PATHNAME?
- Internally the Linux kernel maintains a mount table that keeps information about the mounted file systems
- Each entry on the table contains:
o The device number of the partition that has been mounted
o A pointer to the buffer containing the super block for the file system
o A pointer to the root inode of the file system
o A pointer to the inode of the directory in which the file system is mounted (pointer to the parent directory)
As the kernel is translating a path name, it consults the mount table as needed
To show the mount table use cat/proc/mounts or the bare mount command
Mount File Systems
- what directory is often used to mount a file system?
- can other directories be used for mounting file systems?
- what commands does the mount command take?
- The Linux filesystem hierarchy is a tree
o It consists of the root file system “/”, together with other (optional) file systems mounted at “grafted points” in the root tree - In order to access a file system it must be mounted
- The /mnt directory is often used to mount a file system temporarily but any directory can be used (existing hierarchy below the mount point becomes hidden
- The mount command is used to attach a file system found on some device to the larger file system tree and takes in two arguments
mount table
- what information does it keep?
- what does an entry contain?
- when is it consulted?
- what command should be used to show the mount table?
- Internally the Linux kernel maintains a mount table that keeps information about the mounted file systems
- Each entry on the table contains:
o The device number of the partition that has been mounted
o A pointer to the buffer containing the super block for the file system
o A pointer to the root inode of the file system
o A pointer to the inode of the directory in which the file system is mounted (pointer to the parent directory)
As the kernel is translating a path name, it consults the mount table as needed
To show the mount table use cat/proc/mounts or the bare mount command
Listing inode numbers
- what is a directory
- command to see directory details
Listing inode numbers
A directory is a list of file names and inode numbers
To show this use ls - i command inside a directory to list the file names and inode numbers
Hard vs Symbolic Links
Hard vs Symbolic Links
- Each file in a filesystem is identified by a number called an inode
- Two types of links can be made to a file:
o Hard link
o Soft or symbolic link
- Hard link
o Let’s you assign a different name to a file in a different location but essentially is the same file
o The key that links the files together is the inode number- A new hard link just creates a reference to the same underlying inode of a given file
- When you delete a file it removes that link
- A symbolic link
o Is like a shortcut from one file to another ( like the shortcuts on desktop on windows)- The benefit of a symbolic/short link is that you can link to files on different partitions and on other devices
- Symbolic links can span filesystems, and the file pointed to need not exist, at which point the symbolic link is “dangling”
- A symbolic link point to another file by name not inode
hard link
- Hard link
o Let’s you assign a different name to a file in a different location but essentially is the same file
o The key that links the files together is the inode number - A new hard link just creates a reference to the same underlying inode of a given file
- When you delete a file it removes that link
- A symbolic link
- A symbolic link
o Is like a shortcut from one file to another ( like the shortcuts on desktop on windows) - The benefit of a symbolic/short link is that you can link to files on different partitions and on other devices
- Symbolic links can span filesystems, and the file pointed to need not exist, at which point the symbolic link is “dangling”
- A symbolic link point to another file by name not inode
The Inodes( Handle to File)
- what structure is it?
- what does it hold?
- what information does it contain?
The Inodes( Handle to File) - Is an on-disk data structure
- Holds all the metadata about a file (other than naming)
- It contains the following information
o File access permission
o File ownership indication
o File type
o Time of last access and modified
o Number of links ( aliases to the file)
o Pointers to the data blocks for the file
o Size of file in bytes (for regular files) major and minor device numbers for special devices - An inode does not contain short or full path name of the file
Linux filesystem organization
- the four elements
- what do they contain
- Boot block
o Located in the first few sectors of a filesystem which contains the initial bootstrap program used to load the operating system - Super block
o Describes the state of a file system i.e. the total size of the partition, the block size, pointers to a list of free blocks, the inode number of the root directory - Inodes
o A linear array of inodes
o Inodes = index nodes
o Linux thinks of files in terms of inodes
o There is a one to one mapping from files to inodes, and vice versa - Data blocks
o Contains the actual data of the files
Master Boot Record
- where is it
- what does it contain
- what special code does it contain
- what’s the limit of a MBR in terms of maximum storage and primary partitions
- A master boot record(MBR) is a special type of boot sector at the beginning of partitioned storage device
- The MBR contains information about how the partitions containing the file systems are organised on that medium
- The first stage of the MBR also contains executable code to function as a loader (bootstrapping a chain of actions) for the installed operating system
- The organization of the partition table in the master boot record limits the maximum addressable storage to 2TiB with 4 primary partitions