SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
Linux For Embedded Systems
ForArabs
Ahmed ElArabawy
Course 102:
UnderstandingLinux
Lecture 27:
FileSystems in Linux (Part 2)
User Application
C Library
System Call API
VFSInodes
Dentry
Cache
ext2 JFFS2 FAT NTFS
Buffer Cache
Device Driver Device Driver
User
Kernel
HW
The Big Picture
• User applications access files using a standard API
• This does not change no matter what storage media, partition, or
used file system type
• The used API results in a system call towards the kernel (generated
by the C-Library)
• The system call is received by the VFS (Virtual File System)
subsystem of the Linux Kernel
• This subsystem provides a unified access to the file via the concepts
of nodes and dentries (A previous lecture covered VFS in details)
• VFS then communicate with the used FileSystem that contain this
file
• The filesystem in turn Communicate with the device driver for the
storage media using the block abstraction
• The device driver is responsible for interfacing with the storage
hardware device
Popular FileSystem Types
Linux Extended FileSystems
ext2
• The ext2 used to be the most popular filesystem for Linux
distributions running on a hard disk
• It uses block sizes of 1024, 2048, or 4096 Bytes
• Large values waste disk space if we have a lot of small files
• Small values increase overhead for metadata to point to the different
blocks in the case of large files
• A problem with the ext2 was the risk of filesystem corruption due to
unexpected reboots or power failures
• A planned reboot will unmount all filesystems before the system is
shutdown
• This guarantees that the shutdown does not happen in the middle of
a write operation
• However, in case of a sudden power failure or a system crash, the
filesystem will not be unmounted, and we may run into a corruption
of the data in the fileSystem (some of the data is written without
updating the filesystem metadata)
• The solution for this problem is “Journaling”
Journaling
• The filesystem that support journaling will have a special file
“The Journal File”
• Every time there is a modification to the filesystem (a write
operation), this change is tracked first in the journal file then
committed to the actual file in the filesystem
• This way, we will have a journaling points that we can revert to
in case of a corruption (mismatch between filesystem
contents and its meta-data)
• Upon a boot after a sudden shutdown/reboot, the journal file
is tracked, and compared to the contents of the filesystem
• Changes in the journal may be applied or removed to maintain
data consistency
• Most newer filesystems support Journaling to maintain the
filesystem contents data integrity
Linux Extended FileSystems
ext3
• The ext3 filesystem is an extension to the ext2 filesystem to
support Journalling
• It is both forward and backword compatible with ext2 (we can
convert ext2 filesystem to ext3 and vice versa)
• In ext2 when the system shuts down abruptly, the next boot
takes long time, because a consistency check is run on the
filesystem
• In ext3, no consistency check is needed, the journaling file is
checked to verify changes, which is a much faster process
Linux Extended FileSystems
ext4
• The ext4 filesystem is an extension to the ext3 filesystem
• Currently, it is the default filesystem for Linux
• It also supports journaling
• It removes some of the limitations of ext3,
• The ext4 filesystem can support filesystem size of more than the
16 terabyte which is the limit for ext3
• The ext4 filesystem can support file sizes of up to 1 Terabyte
SecondGenerationJournaling FileSystem
JFFS2 FileSystems
• The jffs2 filesystem is used with flash memory storage devices
• Use of flash memory storage is very common in embedded systems
• Flash memory has the following features:
• Multiple files per Block:
• The block size is large (tens to hundreds of kilobytes). A typical value is 128KB
• This means, we need to be able to store multiple files in the same block
• Accordingly, one block on the flash may contain several small files
• Slow wrtie operations
• Writing a value to an empty place in the flash is performed one byte (or word) at a time
(as normal devices)
• However, you can not erase (or modify) a single byte (word)
• Erasing requires the whole block to be erased
• This means, if we need to modify a small file, this will require the whole block to be
erased, then the block (or another empty one) will be re-written
• This makes write operations in the flash much slower than other devices
• This results in a higher chance of corruption due to power failures during a write
operation
• Flash Lifetime
• Another limitation, flash memory has limited lifetime (specified in number of write
operations)
• Flash memory life time is measured by the number of write operations
• We need to even out the write operations to avoid damaging parts of the flash too early
SecondGenerationJournaling FileSystem
JFFS2 FileSystems
• The jffs2 filesystem handles the flash as follows,
• Due to the slow write operation, journaling becomes very
essential, and hence journaling is supported in JFFS2
• It makes sure that blocks are used evenly to distribute the write
operations on the flash. This is called Wear Leveling
• Special care is needed with the use of tools that keep updating
files such as logging tools (ex. syslogd, and klogd)
• If we have other forms of storage, it would be better to direct the
output away from the flash memory
• Use of caching may be useful to reduce the number of
modifications
• This affects both system performance and flash life-time
Cram FileSystem
cramfs
• This filesystem objective is to compress a filesystem into a
small ROM
• It is a read-only filesystem
• It supports compression of the data in the filesystem
• Useful for small embedded systems to store read only data in
a small ROM or flash
• Ideal for boot ROMs
Memory Hosted FileSystems
ramfs
• A filesystem that lives in the system memory (RAM)
• This provides high access speed, but it is volatile (erased at
reboot time or at shutdown)
• It is different from RamDisks that it can grow and shrink based
on the need
Memory Hosted FileSystems
tmpfs
• Like ramfs, everything is stored in system volatile memory
(RAM)
• Accordingly, contents of this filesystem are lost on power
failure or reboot
• Different from the ramfs in that it can not grow dynamically
• It can also use the swap while the ramfs can not
• Normally mount to /tmp
Network File System
Network FileSystem
NFS
• This filesystem will exist on a remote machine and will be
accessed through the network
• Useful for sharing folders in the network
• A central NFS server will contain the filesystem data
• All machines that need to have access to the data will need to
contain a NFS Client
• Machines with NFS Clients will need to mount the NFS filesystem
(Map to the network drive)
NFS in Embedded Systems
• Another very useful application for NFS is development of Embedded
Systems
• Embedded target flash memory size may not be able to hold all the tools and
utilities used during development
• Hence, all the tools and utilities can be located on a remote machine (NFS
Server) and the target would mount an NFS filesystem to have access to it
• Also, during development, we don’t need to upload the image of the binary
everytime we make a new build, instead, we keep the binary on the
development host machine
• The target can even have its root file system mounted as NFS, so the target
will only carry the bootloader and kernel. All the rest will be on the remote
machine (development host)
Virtual FileSystems
procfs & sysfs
• Those filesystems are not stored in any storage device, but
they are managed by the kernel
• Reading from a file in this filesystem results in a query to the
kernel
• Writing to a file results in sending some info to the kernel
• Those filesystems will be studied in detail in separate lectures
LINUX COMMANDS
Show FileSystem Disk Space Usage
(df Comand)
$ df
Show FileSystem Disk Space Usage
(df Comand)
$ df -i (Show FileSystem inode Usage)
Show Process Disk Usage
(du Command)
$ du <device>
• This command shows the disk usage per process for the disk
specified by the device filename
$ du /dev/sda1
http://Linux4EmbeddedSystems.com

Más contenido relacionado

La actualidad más candente

Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Ahmed El-Arabawy
 
Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Ahmed El-Arabawy
 
Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Ahmed El-Arabawy
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.pptRakesh Kadu
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Ahmed El-Arabawy
 
Course 102: Lecture 6: Seeking Help
Course 102: Lecture 6: Seeking HelpCourse 102: Lecture 6: Seeking Help
Course 102: Lecture 6: Seeking HelpAhmed El-Arabawy
 
Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Ahmed El-Arabawy
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Ahmed El-Arabawy
 
Linux standard file system
Linux standard file systemLinux standard file system
Linux standard file systemTaaanu01
 
Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands Ahmed El-Arabawy
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsAhmed El-Arabawy
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Ahmed El-Arabawy
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Ahmed El-Arabawy
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Ahmed El-Arabawy
 
Linux command ppt
Linux command pptLinux command ppt
Linux command pptkalyanineve
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 

La actualidad más candente (20)

Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals
 
Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell
 
Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling
 
Course 102: Lecture 6: Seeking Help
Course 102: Lecture 6: Seeking HelpCourse 102: Lecture 6: Seeking Help
Course 102: Lecture 6: Seeking Help
 
Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers
 
Linux standard file system
Linux standard file systemLinux standard file system
Linux standard file system
 
Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
Windows server
Windows serverWindows server
Windows server
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
Windows Server 2019 -InspireTech 2019
Windows Server 2019 -InspireTech 2019Windows Server 2019 -InspireTech 2019
Windows Server 2019 -InspireTech 2019
 

Destacado

Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Ahmed El-Arabawy
 
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsEmbedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsAhmed El-Arabawy
 
Files and directories in Linux 6
Files and directories  in Linux 6Files and directories  in Linux 6
Files and directories in Linux 6Meenakshi Paul
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Ahmed El-Arabawy
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Ahmed El-Arabawy
 
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APEmbedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APAhmed El-Arabawy
 
Embedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSEmbedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSAhmed El-Arabawy
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Ahmed El-Arabawy
 
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiEmbedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiAhmed El-Arabawy
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Ahmed El-Arabawy
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewAhmed El-Arabawy
 
Embedded Systems: Lecture 7: Unwrapping the Raspberry Pi
Embedded Systems: Lecture 7: Unwrapping the Raspberry PiEmbedded Systems: Lecture 7: Unwrapping the Raspberry Pi
Embedded Systems: Lecture 7: Unwrapping the Raspberry PiAhmed El-Arabawy
 
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Ahmed El-Arabawy
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesAhmed El-Arabawy
 

Destacado (17)

Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview
 
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsEmbedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded Systems
 
Files and directories in Linux 6
Files and directories  in Linux 6Files and directories  in Linux 6
Files and directories in Linux 6
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APEmbedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
 
Embedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSEmbedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOS
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiEmbedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
Embedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course OverviewEmbedded Systems: Lecture 1: Course Overview
Embedded Systems: Lecture 1: Course Overview
 
Embedded Systems: Lecture 7: Unwrapping the Raspberry Pi
Embedded Systems: Lecture 7: Unwrapping the Raspberry PiEmbedded Systems: Lecture 7: Unwrapping the Raspberry Pi
Embedded Systems: Lecture 7: Unwrapping the Raspberry Pi
 
C 102 lec_29_what_s_next
C 102 lec_29_what_s_nextC 102 lec_29_what_s_next
C 102 lec_29_what_s_next
 
임베디드
임베디드임베디드
임베디드
 
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
Embedded Systems: Lecture 14: Introduction to GNU Toolchain (Binary Utilities)
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment Variables
 
File systems for Embedded Linux
File systems for Embedded LinuxFile systems for Embedded Linux
File systems for Embedded Linux
 

Similar a Course 102: Lecture 27: FileSystems in Linux (Part 2)

UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxLeahRachael
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copyShay Cohen
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and DeadlocksRohit Jain
 
Poking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And ProfitPoking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And Profitssusera432ea1
 
Advanced Storage Area Network
Advanced Storage Area NetworkAdvanced Storage Area Network
Advanced Storage Area NetworkSoumee Maschatak
 
Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)Rudhramoorthi Andiappan
 
12-introductiontolinuxos-190907073928
12-introductiontolinuxos-19090707392812-introductiontolinuxos-190907073928
12-introductiontolinuxos-190907073928SahilNegi60
 
12 introduction to Linux OS
12 introduction to Linux OS12 introduction to Linux OS
12 introduction to Linux OSHameda Hurmat
 
Operating system and installation
Operating system and  installationOperating system and  installation
Operating system and installationIshworKhatiwada
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in LinuxHenry Osborne
 
Hadoop Distributed File System
Hadoop Distributed File SystemHadoop Distributed File System
Hadoop Distributed File SystemMilad Sobhkhiz
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Gaurav Aggarwal
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptxNMohd3
 

Similar a Course 102: Lecture 27: FileSystems in Linux (Part 2) (20)

UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptxUNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
UNIT 4-UNDERSTANDING VIRTUAL MEMORY.pptx
 
Os
OsOs
Os
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and Deadlocks
 
Poking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And ProfitPoking The Filesystem For Fun And Profit
Poking The Filesystem For Fun And Profit
 
Ext filesystem4
Ext filesystem4Ext filesystem4
Ext filesystem4
 
Advanced Storage Area Network
Advanced Storage Area NetworkAdvanced Storage Area Network
Advanced Storage Area Network
 
Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)Do journaling filesystems guarantee against corruption after a power failure (1)
Do journaling filesystems guarantee against corruption after a power failure (1)
 
XFS.ppt
XFS.pptXFS.ppt
XFS.ppt
 
Kernal
KernalKernal
Kernal
 
12-introductiontolinuxos-190907073928
12-introductiontolinuxos-19090707392812-introductiontolinuxos-190907073928
12-introductiontolinuxos-190907073928
 
12 introduction to Linux OS
12 introduction to Linux OS12 introduction to Linux OS
12 introduction to Linux OS
 
Operating system and installation
Operating system and  installationOperating system and  installation
Operating system and installation
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
Hadoop Distributed File System
Hadoop Distributed File SystemHadoop Distributed File System
Hadoop Distributed File System
 
Windows file system
Windows file systemWindows file system
Windows file system
 
Operating system
Operating systemOperating system
Operating system
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
 
Chap1_Part2.pptx
Chap1_Part2.pptxChap1_Part2.pptx
Chap1_Part2.pptx
 

Más de Ahmed El-Arabawy

Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Ahmed El-Arabawy
 
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsCourse 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsAhmed El-Arabawy
 
Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Ahmed El-Arabawy
 
Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Ahmed El-Arabawy
 
Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Ahmed El-Arabawy
 
Course 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsCourse 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsAhmed El-Arabawy
 

Más de Ahmed El-Arabawy (6)

Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild CardsCourse 102: Lecture 4: Using Wild Cards
Course 102: Lecture 4: Using Wild Cards
 
Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu
 
Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land
 
Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems
 
Course 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsCourse 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded Systems
 

Último

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Course 102: Lecture 27: FileSystems in Linux (Part 2)

  • 1. Linux For Embedded Systems ForArabs Ahmed ElArabawy Course 102: UnderstandingLinux
  • 2. Lecture 27: FileSystems in Linux (Part 2)
  • 3. User Application C Library System Call API VFSInodes Dentry Cache ext2 JFFS2 FAT NTFS Buffer Cache Device Driver Device Driver User Kernel HW
  • 4. The Big Picture • User applications access files using a standard API • This does not change no matter what storage media, partition, or used file system type • The used API results in a system call towards the kernel (generated by the C-Library) • The system call is received by the VFS (Virtual File System) subsystem of the Linux Kernel • This subsystem provides a unified access to the file via the concepts of nodes and dentries (A previous lecture covered VFS in details) • VFS then communicate with the used FileSystem that contain this file • The filesystem in turn Communicate with the device driver for the storage media using the block abstraction • The device driver is responsible for interfacing with the storage hardware device
  • 6. Linux Extended FileSystems ext2 • The ext2 used to be the most popular filesystem for Linux distributions running on a hard disk • It uses block sizes of 1024, 2048, or 4096 Bytes • Large values waste disk space if we have a lot of small files • Small values increase overhead for metadata to point to the different blocks in the case of large files • A problem with the ext2 was the risk of filesystem corruption due to unexpected reboots or power failures • A planned reboot will unmount all filesystems before the system is shutdown • This guarantees that the shutdown does not happen in the middle of a write operation • However, in case of a sudden power failure or a system crash, the filesystem will not be unmounted, and we may run into a corruption of the data in the fileSystem (some of the data is written without updating the filesystem metadata) • The solution for this problem is “Journaling”
  • 7. Journaling • The filesystem that support journaling will have a special file “The Journal File” • Every time there is a modification to the filesystem (a write operation), this change is tracked first in the journal file then committed to the actual file in the filesystem • This way, we will have a journaling points that we can revert to in case of a corruption (mismatch between filesystem contents and its meta-data) • Upon a boot after a sudden shutdown/reboot, the journal file is tracked, and compared to the contents of the filesystem • Changes in the journal may be applied or removed to maintain data consistency • Most newer filesystems support Journaling to maintain the filesystem contents data integrity
  • 8. Linux Extended FileSystems ext3 • The ext3 filesystem is an extension to the ext2 filesystem to support Journalling • It is both forward and backword compatible with ext2 (we can convert ext2 filesystem to ext3 and vice versa) • In ext2 when the system shuts down abruptly, the next boot takes long time, because a consistency check is run on the filesystem • In ext3, no consistency check is needed, the journaling file is checked to verify changes, which is a much faster process
  • 9. Linux Extended FileSystems ext4 • The ext4 filesystem is an extension to the ext3 filesystem • Currently, it is the default filesystem for Linux • It also supports journaling • It removes some of the limitations of ext3, • The ext4 filesystem can support filesystem size of more than the 16 terabyte which is the limit for ext3 • The ext4 filesystem can support file sizes of up to 1 Terabyte
  • 10. SecondGenerationJournaling FileSystem JFFS2 FileSystems • The jffs2 filesystem is used with flash memory storage devices • Use of flash memory storage is very common in embedded systems • Flash memory has the following features: • Multiple files per Block: • The block size is large (tens to hundreds of kilobytes). A typical value is 128KB • This means, we need to be able to store multiple files in the same block • Accordingly, one block on the flash may contain several small files • Slow wrtie operations • Writing a value to an empty place in the flash is performed one byte (or word) at a time (as normal devices) • However, you can not erase (or modify) a single byte (word) • Erasing requires the whole block to be erased • This means, if we need to modify a small file, this will require the whole block to be erased, then the block (or another empty one) will be re-written • This makes write operations in the flash much slower than other devices • This results in a higher chance of corruption due to power failures during a write operation • Flash Lifetime • Another limitation, flash memory has limited lifetime (specified in number of write operations) • Flash memory life time is measured by the number of write operations • We need to even out the write operations to avoid damaging parts of the flash too early
  • 11. SecondGenerationJournaling FileSystem JFFS2 FileSystems • The jffs2 filesystem handles the flash as follows, • Due to the slow write operation, journaling becomes very essential, and hence journaling is supported in JFFS2 • It makes sure that blocks are used evenly to distribute the write operations on the flash. This is called Wear Leveling • Special care is needed with the use of tools that keep updating files such as logging tools (ex. syslogd, and klogd) • If we have other forms of storage, it would be better to direct the output away from the flash memory • Use of caching may be useful to reduce the number of modifications • This affects both system performance and flash life-time
  • 12. Cram FileSystem cramfs • This filesystem objective is to compress a filesystem into a small ROM • It is a read-only filesystem • It supports compression of the data in the filesystem • Useful for small embedded systems to store read only data in a small ROM or flash • Ideal for boot ROMs
  • 13. Memory Hosted FileSystems ramfs • A filesystem that lives in the system memory (RAM) • This provides high access speed, but it is volatile (erased at reboot time or at shutdown) • It is different from RamDisks that it can grow and shrink based on the need
  • 14. Memory Hosted FileSystems tmpfs • Like ramfs, everything is stored in system volatile memory (RAM) • Accordingly, contents of this filesystem are lost on power failure or reboot • Different from the ramfs in that it can not grow dynamically • It can also use the swap while the ramfs can not • Normally mount to /tmp
  • 16. Network FileSystem NFS • This filesystem will exist on a remote machine and will be accessed through the network • Useful for sharing folders in the network • A central NFS server will contain the filesystem data • All machines that need to have access to the data will need to contain a NFS Client • Machines with NFS Clients will need to mount the NFS filesystem (Map to the network drive)
  • 17. NFS in Embedded Systems • Another very useful application for NFS is development of Embedded Systems • Embedded target flash memory size may not be able to hold all the tools and utilities used during development • Hence, all the tools and utilities can be located on a remote machine (NFS Server) and the target would mount an NFS filesystem to have access to it • Also, during development, we don’t need to upload the image of the binary everytime we make a new build, instead, we keep the binary on the development host machine • The target can even have its root file system mounted as NFS, so the target will only carry the bootloader and kernel. All the rest will be on the remote machine (development host)
  • 18. Virtual FileSystems procfs & sysfs • Those filesystems are not stored in any storage device, but they are managed by the kernel • Reading from a file in this filesystem results in a query to the kernel • Writing to a file results in sending some info to the kernel • Those filesystems will be studied in detail in separate lectures
  • 20. Show FileSystem Disk Space Usage (df Comand) $ df
  • 21. Show FileSystem Disk Space Usage (df Comand) $ df -i (Show FileSystem inode Usage)
  • 22. Show Process Disk Usage (du Command) $ du <device> • This command shows the disk usage per process for the disk specified by the device filename $ du /dev/sda1