seminar on linux-based embedded systems root file system for raspberry pi aalto university 13 th dec...

22
Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Upload: hilary-ford

Post on 12-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Seminar on Linux-based embedded systemsRoot File system for Raspberry Pi

Aalto University13th Dec 2013

Presenter: Bastian Arjun Shajit (338303)

Page 2: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Agenda

1. Introduction

2. Types of File system

3. Selecting a Root file system

4. Performance Comparison

5. Summary

2

Page 3: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

What is a File system ?

• Gargantuan amount of data stored as 1s and 0s on storage media (conceivable by machine)

• Impossible to understand files/folders from the sea of binary data.

• File system was designed as a novel way to organize such data easily understandable by all users.

3

Page 4: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Definition

• It can refer to – The abstract structure in which files are named and logically

stored in a storage media (RFS)

eg. In any *NIX distribution,

(or)

– The software which provides the core support for implementing the abstraction defined above in the operating system/kernel.

4

/

bin dev home etc lib . . . . . . . . . . . . . .

Root/Top levelDirectory

Page 5: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Agenda

1. Introduction

2. Types of File system

3. Selecting a Root file system

4. Performance Comparison

5. Summary

5

Page 6: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Block-device File Systems

• Considers storage device as a simple linear collection of blocks or sectors.– Size of blocks vary (512, 1024 …)

• Have two main operation : Read & Write• Type of Devices:

– LBA devices (HDDs)– FTL devices (USB flash drive, SD, SSDs etc).

• In case of bad blocks, the FTL or hardware (for LBA devices) takes care of hiding from user.

• File system drivers : ext2, ext3, ext4, FAT, NTFS, ReiserFS etc.

6

Page 7: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Flash File Systems

• Mainly used on Raw Flash Devices• Linux provides MTD as a primitive translation Layer.

• How are they Different?– They are not block devices– Mostly raw NAND / NOR storage media.– They consist of ERASEBLOCKS– Have 3 main operation : Read, Write & Erase Eraseblock– Each block has limited lifespan (1000s of write cycles)

• Needs write to be spread.

7

Page 8: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Flash File Systems II

• FTL devices Vs Raw Flash device– FTL devices has a micro-controller which runs FTL firmware.

• Helps to emulate a block device.

• Why FFS is unique?– Needs to spread write– Perform Garbage collection– Bad blocks handling– Better reliability compared to FTL (Since FTL is vendor specific)

• E.g. UBIFS, JFFS2 etc.

8

Page 9: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

In-Memory File system

• Uses primary memory e.g. RAM• Features:

– Has higher I/O performance– Volatile Memory

• E.g, ramfs, tmpfs, ramdisk.• Why not ramdisk?

– It emulates block device in RAM.– Block device store recently accessed files in caches. Hence

using ramdisk creates a large memory foot print– Hard limit on max size of ram disk.

9

Page 10: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

User Space File system

• Mainly intended for block devices.• Resides in the user space.• Overhead of communicating to and from kernel and

User space.• Distinct Advantage:

– A bad user space file-system can never cause a system crash.

• E.g. ntfs-3g

10

Page 11: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Compressed Read-only File systems

• Read-only filesystem• Data Stored in compressed format.• Especially useful in low memory systems• E.g.

– Cramfs:• Metadata not stored (No time stamps or user permissions)

• Possible security issues.

• Max file system size = 256 MB

– Squashfs• stores metadata information.

• Max filesystem size = 2^64.

11

Page 12: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Linux Virtual File system

• Role of VFS:– Register/de-register– Associate devices and file

system drivers.– Generic File operations

• Caching

• Look ups

– Forward File-system specific

operation:• Read

• Write

• etc

12

Page 13: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Agenda

1. Introduction

2. Types of File system

3. Selecting a Root file system

4. Performance Comparison

5. Summary

13

Page 14: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Selecting a root file-system

• Based on the type of device– Is it Raw flash, RAM or block device

• Based on available system resource.• Based on the type of I/O on the device

– If Read-only, then handle partitions required by kernel for write.

• Based on the data volatility– To persist data or not.

• Based on data usage and demand.

14

Page 15: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Bare minimal Root Filesystem

• Created a bare minimal root filesystem using buildroot for RPi. Refer buildroot manual for instructions, http://buildroot.uclibc.org/downloads/manual/manual.html

• Includes basic utilities.• Saves disc space.• Following figure represents the size of rootfs obtained

from buildroot.

15

TypeRaw Root

Filesystem (MB)

With Kernel Libraries

(MB)

Bare Minimal 4.97 5.32

With Essential Utils 20.65 32.33

Raspbian 1624.89 1641.1

Page 16: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Agenda

1. Introduction

2. Types of File system

3. Selecting a Root file system

4. Performance Comparison

5. Summary

16

Page 17: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Experiment

• Aims at providing a new perspective on how to choose file system based on performance.

• Comparison between ramfs vs ntfs-3g vs ext2• Moved root file-system across different storage media to

analyze performance.• Performance aspects considered:

– I/O speed– CPU usage.

17

Page 18: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Performance Benchmark I

18

Page 19: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Performance Benchmark II

19

Page 20: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Agenda

1. Introduction

2. Types of File system

3. Selecting a Root file system

4. Performance Comparison

5. Summary

20

Page 21: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Summary

• Successfully created a bare minimal and fully loaded root file system.

• There isn’t “One file system to rule them all”. • Varying requirement give rise to numerous possibilities

and a mix & match of different file systems can perhaps solve the need of the hour.

• Many file systems were not analyzed– Raw flash device unavailability to test flash file systems.– Failed experiments with squashfs.– Out of scope file-systems like msdos, nfs, smbfs, cifs.

21

Page 22: Seminar on Linux-based embedded systems Root File system for Raspberry Pi Aalto University 13 th Dec 2013 Presenter: Bastian Arjun Shajit (338303)

Thank you !!!

22