Week 10 - The Linux Filesystem Flashcards

1
Q

File system

A

– The way files are stored and organized to:
* Simplify access to data
* Help OS keep track of how files are organized and how available space is managed on a disk
– Consists of disk partitions
* Disk partitions allow better organization and productivity, data security, data backup, and more

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Linux File system

A

Hierarchical directory structure descending from root
directory (/)
– All partitions are contained under root directory
– All objects, such as devices and directories, treated as files
– Treats each device, such as a monitor, keyboard, or hard drive, as a single file and stores it in /dev directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Creating links

A

Use ln command
Inode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Inode

A

Data structure that stores all information about a file except the actual data and filename
* Stores Filesystem Attributes such as:
– Metadata (create time, modify time)
– Owner and permission data
– Disk block location of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Inode number

A

Like an address
References an entry in inode table
– List of inodes for all files on a Linux partition
– Table entry points to the data’s location on the disk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command to view a file’s inode number

A

ls -il

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Hard links

A

Files that point to data on hard drive
Create a file (e.g. touch)
– Automatically linked to the actual data stored on a partition
– Assigned an inode number referencing this data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a hard link

A

Create a hard link:
– ln existingFile hardLinkToExisingFile
– > ln notes ~/Math

  • Delete files
    – Data isn’t deleted until the last link is deleted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Symbolic (Soft) links

A

Symbolic links
– Also called soft links
– Special types of files that point to other files instead of pointing to data on the hard drive
– Do not share the same inode number
* Benefit of creating a symbolic link
– Link files that are on separate partitions or even different computers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Storage access

A

File Space = Collection of Storage Devices
* Storage Devices
– Hard Disks
– Optical Disks
– Solid State Drives
– USB Drives
– Tape Drives

  • File Space exists two levels of abstraction–
  • Logical: Partitions, Directories, Files
    –Physical: File Systems, Disk Blocks, Pointers

Use file space to store executable programs and data files - two operations Read or write

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Disk storage and blocks

A

To store a file, it is decomposed into fixed size blocks

Each block is then stored at a disk location

Kernel must manage distribution of files to blocks in three ways
1. Given a file and block: map that block onto a physical location on storage medium

  1. Direct the disk drive to access that particular block through (via SSD electrical circuits, or via read/write head of HD)
  2. Maintain free file space (available blocks), including the return of file blocks once a file has been deleted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does the Kernel locate a particular block of a disk?

A

File systems use an indexing scheme
- Windows used File Allocation Table (FAT)
- Upgraded to NFTS (New Technology File System)

In Linux, indexing is handled through inode data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Inode structure

A

Typically, an inode will contain 15 pointers
– 12 Direct pointers
– 1 indirect pointer
– 1 double indirect pointer
– 1 triple indirect pointer

  • Indirect pointers point to Indirect Block
  • Disk block stores ~1-8Kb
    – If our file uses 500 blocks: 500 * 8kb = 4000KB ( 4MB)

If one pointer is 8 bytes, how many can we fit inside an Indirect Block
Number Pointers = Size Of Indirect Block / Size Of Pointer
Number Pointers = 4KB / 8 B
Number Pointer = 4096B / 8B
Number Pointers = 512

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Inodes and Files

A

The system admin will rarely (if ever) have to deal
directly with inodes or pointers
* The Linux filesystem commands operate at a higher level of abstraction
– Admin or Users Operate on Files and Directories
– Device drivers must deal with inodes and the location of disk blocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Directories

A

Directory does not store content like files

File = Collection of data blocks on File Content
Directory = Collection of data blocks on Directory Structure
– Directory data blocks are different
– Blocks contain lists of names and inode numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Filesystem

A

can be thought of as a type of database of files and directories
– Supplies structure to transform simple block device into sophisticated hierarchy of files and sub directories that users can understand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Filesystem types

A

Linus supports many file systems

– Disk file system
* Mounted on a local computer

– Network File System (NFS)
* Mounted on a different partition of a local computer or on a remote computer

Disk Based Filesystems
– Native: ext2, ext3, ext4, btrfs
– Foreign: FAT, NTFS, HFS+
– Universal: ISO 9660 (CDROM)

  • Network Based Filesystems
    – Network File System (NFS)
18
Q

Virtual File System (VFS)

A

– Many types of Filesystems
– VFS ensures that all filesystem implementations support a standard interface so that user applications can access files in the same manner

19
Q

Partition

A

Logical Divisions of Hard Drive
– Disk drives make up Linux Storage space
* Each disk drive can be divided in partitions
* Each partition will contain an independent filesystem
* Multiple partitions can be placed on single physical disk

  • Terminology
    – Storage Space = Collection of storage devices
    – Filesystem = Block Structure for a specific Partition
20
Q

Why use partitions?

A

– Multiple OS’s
– Storing different file systems
– Limiting data growth
* E.g /home directory on different partition to OS file and programs files
* If /home runs out of space, the operating system can still create update files, create logs, install programs etc.

21
Q

Partition table

A

Used to describe partitions on that disk
Partition Table is store in Master Boot Record

22
Q

What can partition utilities be used for?

A

– Create a partition table
– Add a partition
– Create a file system on a disk
– For example: fdisk

23
Q

fdisk

A

– Command line tool
– Can create and modify the partition table provided by Linux
– Can be run only as root
– Can access IDE, SCSI and SATA hard drives

24
Q

Options for fdisk command

A

-a Toggles bootable flag, which indicated whether a partition is bootable

-d Deletes a partition

-l Lists all partition types and their corresponding ID’s

-m displays menu of all options to use with fdisk

-n adds a partition

-p displays a partition table

-q exits fdisk without saving changes

-t changes partition’s system ID

-u Toggles displaying entry units to sectors or cylinders

-v verifies a partition table

-w exits fdisk and saves changes

25
Q

Creating a file system with mkfs command

A

– Can be used to create a Linux file system on a device
* Usually a hard drive but can also be used on a USB thumb drive
– Syntax: mkfs -V -t ext4 /dev/sda3

26
Q

Options for mkfs command

A

-V displays verbose output and file-system specific commands
-t creates a specific file system type, such a s ext3 or ext4
-c device checks the specified drive for corrupted blocks before creating the file system
-v displays verbose output

27
Q

Distributed File System

A

A network allows you to share resources
* Sharing resources is more cost effective than installing resources on each computer
* File server
– A network system where files are stored and shared

28
Q

Distributed file system uses network protocols to?

A
  • Share access to files
    – Do not share actual physical storage device
  • Data Store NOT THE SAME as Distributed File System
    – Distributed Data Store includes cloud based databases
    – Distributed Data Store accessed via proprietary APIs (e.g. mySQL)
    – Distributed File System accessed using same interfaces as local files
29
Q

Distributed Files Systems have a number of transparency goals:

A
  1. Clients should be unaware that files are distributed
  2. File naming should not reveal whether the file is distributed or local
  3. Multiple clients should have the same view of files (if it is being modified, other clients should see the modifications)
30
Q

Network File System (NFS)

A

– A distributed file system protocol for allowing remote access to shared resources across networks
– Used in Unix and Unix Like OS’s (Linux)
– You can mount shared file systems on remote machines
– “Mount”
* Term for making files appear as though they’re on a local machine instead of on a remote machine
* Similar to drive mapping in Windows

31
Q

Advantages of setting up file server in Ubuntu Linux

A

Central Location
Increased Security
Remote Access

32
Q

Exporting a file system

A

Enables users to distribute file systems over the network

33
Q

Importing a file System

A

Makes it possible for users to mount file systems on other hosts

34
Q

Virtual File System

A

Allows client applications to access different types of physical file systems in a uniform way

35
Q

Remote Procedure Calls (RPC)

A

– A protocol that allows one network computer to request a service from a program on another network computer
– NFS relies on RPC to route requests between NFS server and client
* RPC is needed in order for NFS to function

36
Q

Client-side stub

A

procedure that looks to client as if it were a callable server procedure

Client program thinks it is calling server, it is actually calling the client stub

37
Q

Server-side stub

A

looks to server as if a client called it

Server program thinks it is called by client it is actually called by server stub

38
Q

Stubs

A

Send messages to each other to make the RPC happen ‘transparently’

39
Q

NFS and RPC

A

RPC defines set of operations that NFS server must support
– Read and write files
– Access file attributes
– Search for a file
– Read a set of directory links
– Manipulate links and directories

40
Q

Why NFS operations are implemented as RPCs

A

local operation is transformed into an RPC to a server
Server performs operation on its own file system and returns

41
Q

Each NFS RPC (from client to server) specifies:

A

Operation type
File system handle
File ID
Offset in File

42
Q

Remote Procedure Calls (RPC)

A

– A protocol that allows one network computer to request a service from a program on another network computer
– NFS relies on RPC to route requests between NFS server and client