0% found this document useful (0 votes)
7 views39 pages

Chapter 3 - The File System

Chapter 3 of the document discusses the file system, its types, and its integration with operating systems, particularly focusing on Linux and Windows file systems. It covers various file system types including disk, network, and flash file systems, as well as specific systems like FAT, NTFS, and ext3. Additionally, it explains concepts like logical volume management (LVM), RAID, and tools for disk usage analysis such as df and du.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views39 pages

Chapter 3 - The File System

Chapter 3 of the document discusses the file system, its types, and its integration with operating systems, particularly focusing on Linux and Windows file systems. It covers various file system types including disk, network, and flash file systems, as well as specific systems like FAT, NTFS, and ext3. Additionally, it explains concepts like logical volume management (LVM), RAID, and tools for disk usage analysis such as df and du.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 39

Admas University

College of Computing and Informatics


Computer Science Department

Network and System


Administration

Chapter 3: The File System


Contents
 What is file system

 Types of file system

 Disk file systems,

 Network file systems

 Flash file systems.

 File System and Operating System

 Types of Linux file systems

 Log files and syslog

 Determining Disk Usage With df and du

 Logical Volume Management (LVM) and RAID


File System
 File system is a method for storing and organizing
computer files and the data they contain to make it easy
to find and access them.

 Most file systems make use of an underlying data


storage device such as Hard Disks that offers access to
an array of fixed-size blocks which is the smallest logical
amount of disk space that can be allocated to hold a file.

 File systems typically have directories which associate


file names with files, usually by connecting the file name
to an index in a file allocation table of some sort, such as
the FAT in a DOS file system, or an incode in a Unix-like
file system.
File System
 File names are simple strings, and per-file Metadata is

maintained which is the bookkeeping information,

typically associated with each file within a file system.

 Metadata could contain file attributes such as file

size, data and time of creation or modification of the

file, owner of the file, access permissions etc.


Types of File System
 File system types can be classified into

 Disk file systems,

 Network file systems ()

 Flash file systems.

 A disk file system is a file system designed for the


storage of files on a data storage device, most
commonly a disk drive e.g. FAT, NTFS, etx2, ext3
etc.
Types of File System

 A network file system is a file system that acts as a

client for a remote file access protocol, providing

access to files on a server e.g. NFS(Network File

System), SMB(Server Message Block) etc.

 A flash file system is a file system designed for

storing files on flash memory devices.


File System and OS
 Operating systems provide a file system, as a file system is
an integral part of any modern operating system.

 Windows Operating system supports FAT and NTFS File


Systems.
 Linux popularly supports ext2 and ext3 File Systems

 Other flavors of Operating Systems may support other File


Systems like UFS in many UNIX Operating Systems and HFS
in MAC OS X.

 All Operating Systems provide a user interface like Command


Line (CLI) or File Browser to access and manage File System
information.
DOS/Windows File System
FAT
 The File Allocation Table (FAT) file system was initially
developed for DOS Operating System and was later used and
supported by all versions of Microsoft Windows.

 It was an evolution of Microsoft's earlier operating system MS-


DOS and was the predominant File System in Windows
versions like 95, 98, ME etc. All the latest versions of Windows
still support FAT file system although it may not be popular.

 FAT had various versions like FAT12, FAT16 and FAT32.


Successive versions of FAT were named after the number of
bits in the table: 12, 16 and 32.
NTFS New Technology File System
Windows File System

 NTFS or the NT File System was introduced with the


Windows NT operating system.

 NTFS allows ACL-based permission control which was the


most important feature missing in FAT File System.

 Later versions of Windows like Windows 2000, Windows


XP, Windows Server 2003, Windows Server 2008, and
Windows Vista also use NTFS.

 NTFS has several improvements over FAT such as security


access control lists (ACL) and file system journaling.
File System in Linux
 Linux supports many different file systems, but common
choices for the system disk include the ext family (such as
ext2 and ext3), XFS, JFS and Reiser FS.

 The ext3 or third extended file system is a journaled file


system and is the default file system for many popular
Linux distributions

 It is an upgrade of its ancestor ext2 file system and among


other things it has added the journaling feature
File System in Linux

 A journaling file system is a file system that logs

changes to a journal (usually a circular log in a

dedicated area) before committing them to the main

file system.

 Such file systems are less likely to become

corrupted in the event of power failure or system

crash.
FAT

 FAT == File Allocation Table

 FAT is located at the top of the volume.

 two copies kept in case one becomes damaged.

 Cluster size is determined by the size of the volume.


Volume size V.S. Cluster size
FAT32

 Enhancements over FAT

 More efficient space usage

 By smaller clusters.

 Why is this possible? 32 bit entry…

 More robust and flexible

 Root folder became an ordinary cluster chain, thus it


can be located anywhere on the drive.
 Back up copy of the file allocation table.

 Less susceptible to a single point of failure.


NTFS

 MFT == Master File Table


 Analogous to the FAT
 Design Objectives

1) Fault-tolerance

 Built-in transaction logging feature.

2) Security

 Granular (per file/directory) security support.

3) Scalability

 Handling huge disks efficiently.


NTFS

 Scalability

 NTFS references clusters with 64-bit addresses.

 Thus, even with small sized clusters, NTFS can map disks
up to sizes that we won't likely see even in the next few
decades.
 Reliability

 Under NTFS, a log of transactions is maintained so that


CHKDSK can roll back transactions to the last commit point
in order to recover consistency within the file system.
 Under FAT, CHKDSK checks the consistency of pointers
within the directory, allocation, and file tables.
NTFS

 It allows you to access files on remote hosts in exactly the


same way you would access local files.
 NFS offers a number of useful features:

 Data accessed by all users can be kept on a central


host, with clients mounting this directory at boot time.
 For example, you can keep all user accounts on one
host and have all hosts on your network
mount /home from that host.
 If NFS is installed beside NIS, users can log into any
system and still work on one set of files.
Cont..

 Data consuming large amounts of disk space can be


kept on a single host. For example, all files and
programs relating to LaTeX and METAFONT can be kept
and maintained in one place.
 Administrative data can be kept on a single host.

 There is no need to use rcp to install the same stupid


file on 20 different machines.
NTFS Metadata Files

Name MFT Description

$MFT Master File Table

$MFTMIRR Copy of the first 16 records of the MFT

$LOGFILE Transactional logging file

$VOLUMEVolume serial number, creation time, and dirty flag

$ATTRDEF Attribute definitions

. Root directory of the disk


NTFS Metadata Files

Name MFT Description

$BITMAP Cluster map (in-use vs. free)

$BOOT Boot record of the drive

$BADCLUS Lists bad clusters on the drive

$QUOTA User quota

$UPCASE Maps lowercase characters to their uppercase

version
NTFS : MFT record
MFT record for directory
Application~ File System Interaction

Process Open file


control table File descriptors
block (system-wide) (Metadata)
File system
info

File
descriptors

Open Directories
file
pointer ..
array .
File data
open(file…) under the hood

1. Search directory structure fd = open( FileName, access)

for the given file path

2. Copy file descriptors into


PCB Allocate & link up
in-memory data structure data structures

3. Create an entry in system-


wide open-file-table Open
file
Directory look up
4. Create an entry in PCB table by file path

5. Return the file pointer to


user File system on disk
Metadata
read(file…) under the hood

read( fd, userBuf, size )


PCB
Find open file
descriptor
Open
file read( fileDesc, userBuf, size )
table

Logical  phyiscal

Metadata read( device, phyBlock, size )


Get physical block to sysBuf
copy to userBuf
Buffer
cache

Disk device driver


Types of Linux file systems
1. Ordinary files

 Is a file on the system that contains data, text, or program


instructions.
 Used to store your information, such as some text you have
written or an image you have drawn.
 This is the type of file that you usually work with.

 Always located within/under a directory file.

 Do not contain other files.

 In long-format output of ls -l, this type of file is specified by the


“-” symbol.
2. Directories

 Directories store both special and ordinary files.

 For users familiar with Windows or Mac OS, UNIX directories


are equivalent to folders. A directory file contains an entry
for every file and subdirectory that it houses.
 If you have 10 files in a directory, there will be 10 entries in
the directory. Each entry has two components.
 The Filename

 A unique identification number for the file or directory


(called the inode number)
3. Special Files

 Used to represent a real physical device such as a


printer, tape drive or terminal, used for Input/Output
(I/O) operations.
 Device or special files are used for device
Input/Output(I/O) on UNIX and Linux systems.
4. Pipes

 UNIX allows you to link commands together using a pipe.

 The pipe acts a temporary file which only exists to hold

data from one command until it is read by another.

 A Unix pipe provides a one-way flow of data.

 The output or result of the first command sequence is

used as the input to the second command sequence.


5. Sockets

 A Unix socket (or Inter-process communication socket) is a

special file which allows for advanced inter-process


.
communication.

 A Unix Socket is used in a client-server application framework. In

essence, it is a stream of data, very similar to network stream

(and network sockets), but all the transactions are local to the

Filesystem.

 In long-format output of ls -l, Unix sockets are marked by “s”

symbol.
6. Symbolic Link

 Symbolic link is used for referencing some other file of the file system.

 Symbolic link is also known as Soft link.

 It contains a text form of the path to the file it references.

 To an end user, symbolic link will appear to have its own name, but

when you try reading or writing data to this file, it will instead

reference these operations to the file it points to.

 If we delete the soft link itself , the data file would still be there. If we

delete the source file or move it to a different location, symbolic file

will not function properly


Log files and syslog

 Syslog is a way for network devices to send event messages

to a logging server – usually known as a Syslog server.

 System logs deal primarily with the functioning of the

Ubuntu system, not necessarily with additional applications

added by users.

 Examples include authorization mechanisms, system

daemons, system messages, and the all-encompassing

system log itself, syslog.


Key Differences Between fdisk and parted
 Partitioning Scheme:
 fdisk supports only MBR (Master Boot Record), which is limited to 4 primary
partitions.
 parted supports both MBR and GPT, with GPT allowing for more partitions
and larger disks.
 Ease of Use:
 fdisk is simpler and is often used in legacy systems, but it's limited in terms of
partitioning schemes and disk sizes.
 parted is more versatile and supports modern systems, especially those with
large disks.
 When to Use Each Tool:
 Use fdisk when working with MBR partitioned disks or older systems.
 Use parted when you need to work with GPT partitioned disks, or for more
advanced partitioning operations like resizing partitions, or when you're
dealing with disks over 2TB in size.
The basic difference between df and du
 df (Disk Free):
 Purpose: Shows disk space usage for the entire file system or mounted partitions.
 Scope: Reports total space available, used, and free for entire file systems (e.g., /,
/home, external drives).
 Output: Displays the disk usage statistics for all mounted file systems at a high level.
E.g: df -h
 du (Disk Usage):
 Purpose: Shows the disk usage for specific files and directories.
 Scope: Reports space used by files and directories in a given path (can be recursive).
 Output: Provides a detailed breakdown of space used by each file or directory. E.g: du
-sh /home/user
Logical Volume Management (LVM) and RAID
 Logical Volume Management (LVM): is a storage management system that provides
flexibility in managing disk space, allowing for easier resizing of file systems, improved
management of storage volumes, and the ability to combine multiple physical disks into
a single logical volume.
 Key Features of LVM:
 Dynamic Disk Management: You can resize volumes dynamically without having to
repartition disks.
 Volume Groups (VGs): A group of physical disks (PVs) is combined into a volume
group, which acts as a pool of storage space.
 Logical Volumes (LVs): These are the virtual partitions you create from the available
space in a volume group (VG). LVs behave like regular partitions but offer more
flexibility (can be resized easily).
 Physical Volumes (PVs): These are the actual physical devices (like hard drives or
SSDs) that are used in LVM.
 Advantages of LVM:
 Flexibility: Volumes can be resized (expanded or shrunk) without requiring reformatting or
partitioning.
 Snapshots: You can create snapshots of volumes for backup purposes, preserving the current state
of a volume.
 Improved Disk Utilization: Storage space can be dynamically allocated and adjusted as needed.
RAID (Redundant Array of Independent Disks)
 RAID is a technology used to combine multiple physical disks into a single
logical unit to improve performance, redundancy (fault tolerance), or both. RAID
can be implemented in both hardware and software.
 Advantages of RAID:
 Fault Tolerance: RAID provides redundancy, protecting against data loss in case
of disk failure (depending on the RAID level).
 Improved Performance: Some RAID levels improve read/write performance by
distributing data across multiple disks.
 Increased Storage Capacity: RAID can combine multiple smaller disks into a
larger logical volume, allowing for better utilization of available storage.
 When to Use LVM vs RAID:
 LVM is best when you need flexibility to resize storage volumes dynamically and
manage large amounts of storage more easily. It doesn’t provide redundancy by
itself, but can be used in combination with RAID for redundancy.
 RAID is best when you need data protection (redundancy) or performance
improvements through multiple disks. RAID can be used for high-availability
applications.
LVM Vs RAID

You might also like