SlideShare a Scribd company logo
File Systems 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 
All Rights Reserved.
What to Expect? 
W's of File System 
Building a Root File System 
Building the BusyBox 
Creating Ramdisk 
Booting Through NFS 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 
All Rights Reserved.
What is a File System? 
Place to store Data in form of Files 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 
All Rights Reserved.
File System in the 3 Spaces 
Three things at three levels 
Hardware Space – The Physical Organization 
of Data on the Storage Devices 
Kernel Space – Drivers to decode & access 
the data from the Physical Organization 
User Space – All what you see from / - The 
User View 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 4 
All Rights Reserved.
Do we need one in ES? 
Let's observe the Desktop Environment 
Where & Which are the File Systems 
there? 
Where: Hard Disk, CDROM, Pen Drive, … 
Which: FAT, FAT32, NTFS, iso9600, ext3, … 
What are they for? 
For (Operating) System's Data 
For your Data 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 
All Rights Reserved.
So, do we need FS in ES? 
Answer is in the following two Questions 
Do we need to have a Operating System running on it? 
Do we need to store our data on it? 
First one is definitely yes 
Second is requirement based 
But the needs & the storage medium for the two 
could be different 
And accordingly, we have a wide variety of File 
Systems to choose from 
Let's understand 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 6 
All Rights Reserved.
FS for Operating System 
Also referred as the Root File System (RFS) 
A Minimal RFS should contain the following 
Binaries (/bin, /sbin) 
Libraries (/lib) 
Devices (/dev) 
Configurations (/etc) 
Virtual File Systems (/proc, /sys) 
Application Temporary File (/tmp) 
Variable Data from Daemons & Utilities (/var) 
User Data (/root, /home) – optional 
Mount points (/mnt, /media) – optional 
Additional software (/usr, /opt) - optional 
Bootloader files (/boot) – optional 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 
All Rights Reserved.
Building a Root File System 
Involves 
Creating & Populating the complete directory structure, appropriately 
Putting that in the desired FS type 
Either on the host & then transferring it to the target, or directly on the target 
Various sources 
Binaries – Application Sets (busybox, ...) 
Libraries – Toolchain Libraries (glibc, uClibc, …) 
Devices – Create by Hand, Or Device package 
Virtual & Temporary Files – Create by Hand 
Configuration & Variable – Created as required 
Many a times, a more easier way is 
Start with a reference RFS 
Add-on whatever needed 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 
All Rights Reserved.
busybox – A special mention 
busybox is so-called a Swiss Knife 
Contains reduced size versions of the most commonly 
used Unix utilities, all in a single executable 
Shell environment being just the starting point 
It provides 
init system as per System V standard 
Startup applications & Service daemons 
mdev: Light-weight udev implementation 
TinyLogin: Set of logging utilities 
… 
Building it is similar to any other OSS 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 9 
All Rights Reserved.
Building the busybox 
Untar the busybox 
Get into its folder 
make menuconfig 
Select the required options 
make 
make CONFIG_PREFIX=<path_to_rootfs> 
install 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 
All Rights Reserved.
Creating the Root Filesystem 
Add the required directories 
dev, dev/pts, etc, etc/init.d, lib, mnt, opt 
Update the fstab to have proc and /dev/pts filesystems mounted 
automatically 
proc /proc proc defaults 0 0 
none /dev/pts devpts mode=0622 0 0 
Add the files required by the login utilities 
Add root:x:0:root in etc/group 
Add root:0:0:0:/root:/bin/ash in /etc/passwd 
Add 127.0.0.1 localhost in etc/hosts 
Copy the following from Templates/CreatingRootFs/Target/etc/ (available 
from Downloads section of http://sysplay.in) 
Add the inittab file 
Add the init.d/rcS 
Add the mdev.conf file 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 11 
All Rights Reserved.
Adding the shared Libraries 
cd lib 
cp – r /usr/local/angstrom/arm/arm-angstrom- 
linux-gnueabi/lib/ * 
arm-linux-strip * 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 
All Rights Reserved.
Creating the Ram Disk 
Create the 16M file of 'zero' 
dd if=/dev/zero of=rd-ext2.bin bs=1k count=16384 
Create the empty filesystem 
mke2fs -F -m 0 -b 1024 rd-ext2.bin 
Fill the filesytem with contents 
mount -t ext2 rd-ext2.bin /mnt -o loop 
tar -C Target -cf - . | tar -C /mnt -xf - 
Arguments to be passed to the Kernel 
root = /dev/ram0 rw ramdisk_size=16384 
initrd=0x90000000,16M 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 
All Rights Reserved.
Choosing RFS Types 
initramfs – For initial board bringup cycles 
nfs – For initial development 
squashfs – For read only storage 
jffs2 – For flash-based storage 
ext* - For large size storage 
… 
Please note that, we can't use any of fat, vfat, ntfs, … 
As they do not support device & special files on them 
ext3 supports 7 different types of files 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 
All Rights Reserved.
HOWTO of a Read Only FS 
Most of the Embedded System FS are 
Created on the Host, as images 
And then transferred to the Target 
Let's take an Example: squashfs 
Creating (on Host) 
mksquashfs [options] <rfs_dir> <img_file> 
Transferring (on Target) 
dd if=<img_file> of=<part_for_fs> 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 
All Rights Reserved.
Creating initramfs 
Done during Kernel Building 
Before building the Kernel, configure the 
following 
Under “General setup” 
Enable “Initial RAM filesystem … support” 
Set the “Initramfs source file(s)” to the RFS dir 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 
All Rights Reserved.
Root File System over NFS 
Enable NFS mount of the RFS directory on the 
host 
Update the Target's Kernel image with 
Root over NFS feature enabled 
On the target, add the following to the 
bootargs, before booting 
root=/dev/nfs 
nfsroot=<host_ip>:<rfs_dir_on_host> 
Argument for assigning an IP address 
Boot the target to use the RFS over NFS 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 
All Rights Reserved.
What about swap partition? 
Purposes of swap partition (on Desktop) 
Process Swapping in case Memory is less 
Hibernation 
Embedded Systems 
Has less Memory. So, if there is swap, it would 
be used frequently. But where? Flash??? What 
about its write cycles, write levelling? 
Typically, no Hibernation needed 
Hence, no swap on Embedded Systems 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 
All Rights Reserved.
Other File Systems 
/ → Root File System → One particular FS 
However, subdirectories under / could be 
On other Partitions, Or 
Even other File Systems 
Examples: 
/ → initramfs; /home → jffs2 
/ → squashfs; /var & /tmp → tmpfs 
/ → jffs2; /home → ext2 or fat 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 
All Rights Reserved.
Feature-specific File Systems 
Journalizing FS: ext2 vs ext3 
Read-only FS vs Mounting Read-only 
Compressed FS: cramfs, squashfs 
Flash-Specific FS: jffs2 
Temporary Storage: ramfs, tmpfs, ... 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 
All Rights Reserved.
What all have we learnt? 
W's of File System 
Building a Root File System 
Building the BusyBox 
Creating Ramdisk 
Booting Through NFS 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 
All Rights Reserved.
Any Queries? 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 22 
All Rights Reserved.

More Related Content

PDF
Linux Memory Management
PDF
File System Modules
PDF
Character Drivers
PDF
File System Modules
PDF
BeagleBoard-xM Bootloaders
PDF
Introduction to Linux
PDF
PCI Drivers
PDF
Introduction to Linux
Linux Memory Management
File System Modules
Character Drivers
File System Modules
BeagleBoard-xM Bootloaders
Introduction to Linux
PCI Drivers
Introduction to Linux

What's hot (20)

PDF
System Calls
PDF
Embedded Storage Management
PDF
Linux File System
PDF
BeagleBone Black Bootloaders
PDF
Embedded Software Design
PDF
Architecture Porting
PDF
Linux User Space Debugging & Profiling
PPT
Linux filesystemhierarchy
PDF
Bootloaders
PPT
Linux io
PDF
BeagleBoard-xM Booting Process
PDF
BeagleBone Black Booting Process
PDF
USB Drivers
PDF
Linux Porting
PDF
PDF
BeagleBone Black Bootloaders
PDF
Block Drivers
PPSX
linux kernel overview 2013
PDF
System Calls
PDF
Introduction to Embedded Systems
System Calls
Embedded Storage Management
Linux File System
BeagleBone Black Bootloaders
Embedded Software Design
Architecture Porting
Linux User Space Debugging & Profiling
Linux filesystemhierarchy
Bootloaders
Linux io
BeagleBoard-xM Booting Process
BeagleBone Black Booting Process
USB Drivers
Linux Porting
BeagleBone Black Bootloaders
Block Drivers
linux kernel overview 2013
System Calls
Introduction to Embedded Systems
Ad

Viewers also liked (20)

PPT
Xfs file system for linux
PPT
Dbms
PPT
Ch 1-final-file organization from korth
PPT
File organization 1
PDF
Kernel Debugging & Profiling
PDF
gcc and friends
PDF
Embedded C
PDF
References
PDF
Interrupts
PDF
Network Drivers
PDF
Introduction to Linux Drivers
DOCX
Database management system
PPTX
Dbms slides
PPT
Database Management Systems (DBMS)
PPT
Management Information System (MIS)
Xfs file system for linux
Dbms
Ch 1-final-file organization from korth
File organization 1
Kernel Debugging & Profiling
gcc and friends
Embedded C
References
Interrupts
Network Drivers
Introduction to Linux Drivers
Database management system
Dbms slides
Database Management Systems (DBMS)
Management Information System (MIS)
Ad

Similar to File Systems (20)

PDF
Details on Root Filesystem in Embedded Linux
PDF
Root file system for embedded systems
PDF
File systems for Embedded Linux
PPTX
Root file system
PDF
Course 102: Lecture 27: FileSystems in Linux (Part 2)
PPT
4.1 create partitions and filesystems
PPTX
Disk and File System Management in Linux
PPTX
EMBEDDED KERNEL and its COMPONENTS.pptx
PPTX
Files and directories in Linux 6
PPTX
file system overview in oerating system .
PPT
101 4.1 create partitions and filesystems
PPTX
How to design a file system
PPT
101 4.1 create partitions and filesystems
ODP
4. linux file systems
PPT
101 2.1 design hard disk layout
PDF
linuxfilesystem-180727181106 (1).pdf
PPTX
Linux file system
PDF
Linux fundamental - Chap 10 fs
PDF
Course 102: Lecture 26: FileSystems in Linux (Part 1)
PPT
2.1 design hard disk layout v2
Details on Root Filesystem in Embedded Linux
Root file system for embedded systems
File systems for Embedded Linux
Root file system
Course 102: Lecture 27: FileSystems in Linux (Part 2)
4.1 create partitions and filesystems
Disk and File System Management in Linux
EMBEDDED KERNEL and its COMPONENTS.pptx
Files and directories in Linux 6
file system overview in oerating system .
101 4.1 create partitions and filesystems
How to design a file system
101 4.1 create partitions and filesystems
4. linux file systems
101 2.1 design hard disk layout
linuxfilesystem-180727181106 (1).pdf
Linux file system
Linux fundamental - Chap 10 fs
Course 102: Lecture 26: FileSystems in Linux (Part 1)
2.1 design hard disk layout v2

More from Anil Kumar Pugalia (19)

PDF
Kernel Debugging & Profiling
PDF
PDF
Playing with R L C Circuits
PDF
Audio Drivers
PDF
Video Drivers
PDF
Mobile Hacking using Linux Drivers
PDF
Shell Scripting
PDF
Functional Programming with LISP
PDF
Power of vi
PDF
"make" system
PDF
Hardware Design for Software Hackers
PDF
RPM Building
PDF
Linux Network Management
PDF
PDF
Synchronization
PDF
PDF
PDF
Inter Process Communication
Kernel Debugging & Profiling
Playing with R L C Circuits
Audio Drivers
Video Drivers
Mobile Hacking using Linux Drivers
Shell Scripting
Functional Programming with LISP
Power of vi
"make" system
Hardware Design for Software Hackers
RPM Building
Linux Network Management
Synchronization
Inter Process Communication

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Electronic commerce courselecture one. Pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Electronic commerce courselecture one. Pdf
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks

File Systems

  • 1. File Systems © 2010-14 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved.
  • 2. What to Expect? W's of File System Building a Root File System Building the BusyBox Creating Ramdisk Booting Through NFS © 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 All Rights Reserved.
  • 3. What is a File System? Place to store Data in form of Files © 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 All Rights Reserved.
  • 4. File System in the 3 Spaces Three things at three levels Hardware Space – The Physical Organization of Data on the Storage Devices Kernel Space – Drivers to decode & access the data from the Physical Organization User Space – All what you see from / - The User View © 2010-14 SysPlay Workshops <workshop@sysplay.in> 4 All Rights Reserved.
  • 5. Do we need one in ES? Let's observe the Desktop Environment Where & Which are the File Systems there? Where: Hard Disk, CDROM, Pen Drive, … Which: FAT, FAT32, NTFS, iso9600, ext3, … What are they for? For (Operating) System's Data For your Data © 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 All Rights Reserved.
  • 6. So, do we need FS in ES? Answer is in the following two Questions Do we need to have a Operating System running on it? Do we need to store our data on it? First one is definitely yes Second is requirement based But the needs & the storage medium for the two could be different And accordingly, we have a wide variety of File Systems to choose from Let's understand © 2010-14 SysPlay Workshops <workshop@sysplay.in> 6 All Rights Reserved.
  • 7. FS for Operating System Also referred as the Root File System (RFS) A Minimal RFS should contain the following Binaries (/bin, /sbin) Libraries (/lib) Devices (/dev) Configurations (/etc) Virtual File Systems (/proc, /sys) Application Temporary File (/tmp) Variable Data from Daemons & Utilities (/var) User Data (/root, /home) – optional Mount points (/mnt, /media) – optional Additional software (/usr, /opt) - optional Bootloader files (/boot) – optional © 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 All Rights Reserved.
  • 8. Building a Root File System Involves Creating & Populating the complete directory structure, appropriately Putting that in the desired FS type Either on the host & then transferring it to the target, or directly on the target Various sources Binaries – Application Sets (busybox, ...) Libraries – Toolchain Libraries (glibc, uClibc, …) Devices – Create by Hand, Or Device package Virtual & Temporary Files – Create by Hand Configuration & Variable – Created as required Many a times, a more easier way is Start with a reference RFS Add-on whatever needed © 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 All Rights Reserved.
  • 9. busybox – A special mention busybox is so-called a Swiss Knife Contains reduced size versions of the most commonly used Unix utilities, all in a single executable Shell environment being just the starting point It provides init system as per System V standard Startup applications & Service daemons mdev: Light-weight udev implementation TinyLogin: Set of logging utilities … Building it is similar to any other OSS © 2010-14 SysPlay Workshops <workshop@sysplay.in> 9 All Rights Reserved.
  • 10. Building the busybox Untar the busybox Get into its folder make menuconfig Select the required options make make CONFIG_PREFIX=<path_to_rootfs> install © 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 All Rights Reserved.
  • 11. Creating the Root Filesystem Add the required directories dev, dev/pts, etc, etc/init.d, lib, mnt, opt Update the fstab to have proc and /dev/pts filesystems mounted automatically proc /proc proc defaults 0 0 none /dev/pts devpts mode=0622 0 0 Add the files required by the login utilities Add root:x:0:root in etc/group Add root:0:0:0:/root:/bin/ash in /etc/passwd Add 127.0.0.1 localhost in etc/hosts Copy the following from Templates/CreatingRootFs/Target/etc/ (available from Downloads section of http://sysplay.in) Add the inittab file Add the init.d/rcS Add the mdev.conf file © 2010-14 SysPlay Workshops <workshop@sysplay.in> 11 All Rights Reserved.
  • 12. Adding the shared Libraries cd lib cp – r /usr/local/angstrom/arm/arm-angstrom- linux-gnueabi/lib/ * arm-linux-strip * © 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 All Rights Reserved.
  • 13. Creating the Ram Disk Create the 16M file of 'zero' dd if=/dev/zero of=rd-ext2.bin bs=1k count=16384 Create the empty filesystem mke2fs -F -m 0 -b 1024 rd-ext2.bin Fill the filesytem with contents mount -t ext2 rd-ext2.bin /mnt -o loop tar -C Target -cf - . | tar -C /mnt -xf - Arguments to be passed to the Kernel root = /dev/ram0 rw ramdisk_size=16384 initrd=0x90000000,16M © 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 All Rights Reserved.
  • 14. Choosing RFS Types initramfs – For initial board bringup cycles nfs – For initial development squashfs – For read only storage jffs2 – For flash-based storage ext* - For large size storage … Please note that, we can't use any of fat, vfat, ntfs, … As they do not support device & special files on them ext3 supports 7 different types of files © 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 All Rights Reserved.
  • 15. HOWTO of a Read Only FS Most of the Embedded System FS are Created on the Host, as images And then transferred to the Target Let's take an Example: squashfs Creating (on Host) mksquashfs [options] <rfs_dir> <img_file> Transferring (on Target) dd if=<img_file> of=<part_for_fs> © 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 All Rights Reserved.
  • 16. Creating initramfs Done during Kernel Building Before building the Kernel, configure the following Under “General setup” Enable “Initial RAM filesystem … support” Set the “Initramfs source file(s)” to the RFS dir © 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 All Rights Reserved.
  • 17. Root File System over NFS Enable NFS mount of the RFS directory on the host Update the Target's Kernel image with Root over NFS feature enabled On the target, add the following to the bootargs, before booting root=/dev/nfs nfsroot=<host_ip>:<rfs_dir_on_host> Argument for assigning an IP address Boot the target to use the RFS over NFS © 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 All Rights Reserved.
  • 18. What about swap partition? Purposes of swap partition (on Desktop) Process Swapping in case Memory is less Hibernation Embedded Systems Has less Memory. So, if there is swap, it would be used frequently. But where? Flash??? What about its write cycles, write levelling? Typically, no Hibernation needed Hence, no swap on Embedded Systems © 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 All Rights Reserved.
  • 19. Other File Systems / → Root File System → One particular FS However, subdirectories under / could be On other Partitions, Or Even other File Systems Examples: / → initramfs; /home → jffs2 / → squashfs; /var & /tmp → tmpfs / → jffs2; /home → ext2 or fat © 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 All Rights Reserved.
  • 20. Feature-specific File Systems Journalizing FS: ext2 vs ext3 Read-only FS vs Mounting Read-only Compressed FS: cramfs, squashfs Flash-Specific FS: jffs2 Temporary Storage: ramfs, tmpfs, ... © 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 All Rights Reserved.
  • 21. What all have we learnt? W's of File System Building a Root File System Building the BusyBox Creating Ramdisk Booting Through NFS © 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 All Rights Reserved.
  • 22. Any Queries? © 2010-14 SysPlay Workshops <workshop@sysplay.in> 22 All Rights Reserved.