1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
% on the following slides, include icon in the left sidebar
\def\lximg{/usr/share/lx/icons/fueller.png}
\input{configpres}
\title{Filesystems}
\maketitle
% stop displaying 'fueller.png' on the following slides
\def\lximg{none}
\subsection{Filesystems}
\subsubsection{Types}
\begin{frame}
\frametitle{Filesystem types}
\begin{itemize}
\item Filesystems for block devices
\item Filesystems for flash devices
\item Network filesystems (e.g. NFS)
\end{itemize}
\end{frame}
\subsubsection{For block devices}
\begin{frame}
\frametitle{Filesystems for block devices}
\begin{itemize}
\item EXT2
\item EXT3, EXT4
\item ReiserFS
\item XFS
\end{itemize}
Filesystem for ''flash based'' block devices:
\begin{itemize}
\item F2FS
\end{itemize}
\end{frame}
\subsubsection{For flash}
\begin{frame}
\frametitle{Flash filesystems}
\begin{itemize}
\item JFFS2
\item YAFFS2
\item LogFS
\item UbiFS
\end{itemize}
\end{frame}
\subsubsection{Journaling}
\begin{frame}
\frametitle{Journalling Filesystems}
\begin{alertblock}{What is a journalling filesystem?}
A ''Journalling Filesystem'' keeps track of all changes in a special memory area
(the journal). Based on the informations in the journal, files can be
reconstructed if a write access gets interrupted (for example by a system
crash or a power failure).
\end{alertblock}
\end{frame}
\subsubsection{Technical terms}
\begin{frame}
\frametitle{Technical terms}
\begin{itemize}
\item Block: Filesystems are usually organised in blocks. Small blocks won't
waste that much memory for small files; large blocks will increase the maximum
size of a filesystem
\item Inode: Stores information about regular files, directories, ...
\item Superblock: The superblock stores all information about the filesystem
\end{itemize}
\end{frame}
\subsubsection{EXT filesystems}
\begin{frame}
\frametitle{EXT2}
\begin{itemize}
\item \textbf{N}o journalling filesystem
\item A good choice for ''flash-based block devices'', like SD cards or USB
sticks (ext2 minimizes the number of writes), if you have heavy write access. F2FS
might be an alternative for flash devices
\item Supported block sizes: 1kb, 2kb, 4kb, 8kb
\item Max. filesystem size: 32TB (for 8kb blocks)
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{EXT3}
\begin{itemize}
\item \textbf{Journalling} filesystem
\item Three levels of journalling available: journal, ordered, writeback
\item Backward compatible with EXT2
\item Limited to 32.000 sub-directories
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{EXT4}
\begin{itemize}
\item \textbf{Journalling} filesystem
\item Backward compatible with EXT2 and EXT3
\item Faster filesystem checking
\item Filesystem size up 1 exabyte
\item Journal checksumming
\item \textbf{No longer} limited to 32.000 sub-directories
\end{itemize}
\end{frame}
\subsubsection{XFS}
\begin{frame}
\frametitle{XFS}
\begin{itemize}
\item \textbf{Journalling} filesystem
\item max. FILESIZE: 8 Exabyte !
\item Online defragmentation (using xfs\_fsr)
\item Online resizing (using xfs\_growfs)
\item Good choice for servers (e.g. file servers)
\end{itemize}
\end{frame}
\subsubsection{Flash filesystems}
\begin{frame}
\frametitle{F2FS}
\begin{itemize}
\item F lash F riendly F ilesystem
\item Available since Linux Kernel 3.8 (backports available back to 3.0)
\item Not a ''real'' flashfilesystem
\item For ''NAND flash based'' block devices, like SD, MMC, eMMC, ...
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{JFFS2}
\begin{itemize}
\item Flash filesystem
\item Used on top of MTD devices
\item All nodes must be scanned at mount time
\item Mount time and memory consumption linearly depend on the filesystem size
\item \textbf{No} powerfail safety
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{UbiFS}
\begin{itemize}
\item Flash filesystem
\item Used on top of UBI volumes
\item Fast mount time
\item Supports LZO and ZLIB compression
\item Powerfail safety !!!
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Recommendations}
\begin{itemize}
\item ''Flash-based block devices'': EXT2
\item Block devices: EXT3, EXT4
\item Block devices which are used in server machines (on which huge amounts
of data are stored): XFS
\item Flash devices: UbiFS
\end{itemize}
\end{frame}
\subsubsection{Creating and testing filesystems}
\begin{frame}[fragile]
\frametitle{Creating filesystems}
\begin{lstlisting}[keywordstyle=\ttfamily\footnotesize]
# EXT2 filesystem in a file
$ dd if=/dev/zero of=ext2.img \
bs=2048 count=1024
$ /sbin/mkfs.ext2 -b 2048 ext2.img
myext2.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
256 inodes, 1024 blocks
51 blocks (4.98%) reserved for the super user
First data block=0
1 block group
16384 blocks per group, 16384 fragments per group
256 inodes per group
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Creating filesystems}
\begin{lstlisting}[keywordstyle=\ttfamily\footnotesize]
# EXT2 filesystem on a disk partition
mkfs.ext2 -b 2048 /dev/sdb2
# Checking an EXT2 filesystem
fsck.ext2 /dev/sdb2
# Mounting an EXT2 partition
mount -t ext2 /dev/sdb2 /mountpoint
# or just
mount /dev/sdb2 /mountpoint
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Testing filesystems for block devices}
\begin{lstlisting}[keywordstyle=\ttfamily\footnotesize]
# 1) Mounting a filesystem which is located in a file
mount -o loop ext2.imt /mountpoint
# 2) Mounting a specific partition of a complete disk image
$ fdisk -lu bla.img
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
[...]
Device Boot Start End Blocks Id System
bla.img1 63 64259 32098+ 83 Linux
# Now multiply the start offset (63) with
# the sector size (512) = 32256
$ mount -o offset=32256 /mountpoint
\end{lstlisting}
\end{frame}
\begin{frame}
\frametitle{Testing flash filesystems}
\begin{itemize}
\item You can emulate flash devices on your host system, if you want to test
your flash filesystem
\item \textbf{mtdram} can emulate NOR devices
\item \textbf{nandsim} can emulate NAND devices
\item This will be covered in a different chapter
\end{itemize}
\end{frame}
\subsubsection{sources}
\begin{frame}
\begin{thebibliography}{1}
\bibitem{ext2} http://en.wikipedia.org/wiki/Ext2
\bibitem{ext3} http://en.wikipedia.org/wiki/Ext3
\bibitem{ext4} http://en.wikipedia.org/wiki/Ext4
\bibitem{xfs} http://en.wikipedia.org/wiki/XFS
\bibitem{UBIFS} http://en.wikipedia.org/wiki/UBIFS
\end{thebibliography}
\end{frame}
\input{tailpres}
|