Linux File System
Presented by:
Aamir Ali (19mtcsnt02)
M.Tech (Computer Science and
Technology)
Contents:
What is file System?
Linux Directories Structure
Mounting
I-node Data structure
Linux File System
Types of Linux File system
Data recovery tools in linux
PhotoRec Data recovery Tool
Linux File System
Linux File System or any file system
generally is a layer which is under the
operating system that handles the
positioning of your data on the storage,
without it; the system cannot knows
which file starts from where and ends
where.
/ (root filesystem)- The root filesystem is the top-
level directory of the filesystem.
/bin- Contains user executable files.
/boot- Contains the static bootloader and kernel
executable and configuration files required to boot a
Linux computer.
/dev- This directory contains the device files for
every hardware device attached to the system.
/etc- contains the local system configuration files
for the host computer.
/home- Home directory storage for user files. Each
user has a subdirectory in /home.
/media- A place to mount external removable
media devices such as USB thumb drives that may
be connected to the host.
/mnt- A temporary mountpoint for regular
filesystems (as in not removable media)
that can be used while the administrator is
repairing or working on a filesystem.
/tmp- Temporary directory. Used by the
operating system and many programs to
store temporary files. Users may also store
files here temporarily. Note that files stored
here may be deleted at any time without
prior notice.
Mounting
Command- mount
Mounting means attaching the file to the
filesystem.
All the devices are needed to mount (place)
in location from where it can be access
manually.
Syntex- mount <Source device path>
<destination dir path>
Command – umount <source/destination
path>
Mounting
Allthe devices are needed to mount
(place) in location from where it can be
access manually by specifying the file
system type.
Syntex- mount –t <type file system> <source
device path> <destination dir path>
Command- umount
To unmount the file system
syntex- <source/destination path>
I-node
A file system contains ‘blocks’ which hold
data called inodes. A inode describes a
single file in the file system. Typical
information described includes, ownership,
modification times, size and permissions.
We call this information meta-data.
Data Blocks The remainder of the file
system (larger proportion) contains data
blocks. These store the contents of files.
All together
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
Assuming 32-bit architectures
32-bit = 4 bytes (32 / 8)
Thus 8192 [block size] / 4 [bytes per
addressable block]
= 2048 Addressable Blocks
Types of Linux File
System
A standard Linux Distribution provides
the choice of partitioning disk with the
file formats listed below, each of which
has special meaning associated with it.
ext2
ext3
ext4
jfs
Ext- Extended file system
Ext, was implemented in April 1992 as the
first file system created specifically for
the Linux kernel.
It is developed by Remy Card.
Design to overcome limitations of the MINIX
file system.
It could handle system upto 2GB.
Ext2 – Second Extended File
System
Ext2 stands for second extended file
system.
It was introduced in 1993. Developed by
Rémy Card.
This was developed to overcome the
limitation of the original ext file system.
Ext2 does not have journaling feature.
Support file name size- upto 255 characters
Maximum individual file size can be from
16 GB to 2 TB
Overall ext2 file system size can be from 2
TB to 32 TB
Creating Ext2 File System
Ext3 – Third Extended File
System
Ext3 file system was introduced in 2001.
Starting from Linux Kernel 2.4.15 ext3 was
available.
Max file size 16GB – 2TB.
Overall ext3 file system size can be from 2 TB to 32
TB
The main benefit of ext3 is that it allows journaling.
Provide facility to upgrade from Ext2 to Ext3 file
systems without having to back up and restore
data.
Disk recovery time is very less after improper
shutdown.
Command to create the ext3 file
system
Jaurnaling Process
Ext4 – Fourth Extended File
System
Ext4 stands for fourth extended file system.
It was introduced in 2008.
Starting from Linux Kernel 2.6.19 ext4 was available.
Supports huge individual file size and overall file
system size.
Maximum individual file size can be from 16 GB to
16 TB
Overall maximum ext4 file system size is 1 EB
(exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024
TB (terabyte).
Directory can contain a maximum of 64,000
subdirectories. (as opposed to 32,000 in ext3)
Creating Ext4 File System
JFS (Journaled File System)
The Journaled File System (JFS) was
developed by IBM for AIX UNIX which
was used as an alternative to system
ext. JFS is an alternative
to ext4 currently and is used where
stability is required with the use of very
few resources. When CPU power is
limited JFS comes handy.
File Recovery Steps Using
Photorec
sudo apt-get install testdisk
sudo photorec
Select hard disk.
Select partition type.
If your hard disk has Linux partitions, then
select [Intel].
Select filetype option.
Move to [File Opt] and press Enter. Here you can
disable all file types by pressing s. Use space to toggle
the check button. Select filetype(s) to recover. For Perl
you can select pl for Perl script or pm for Perl module.
Select options.
Photorec also has a list of different options. Under normal
circumstances you don’t need to modify them.
Select partition.
Move the selector up or down to the partition from which
you have removed the file(s). Then select [Search] and
press Enter.
Select filesystem type.
If you are using Linux, it's going to be ext2/ext3/ext4, so the
default selection is ext2/ext3. Otherwise if you are
recovering files from a partition formatted as FAT or NTFS
select Other.
Select space for analysis.
Select Free if you didn’t write to that partition after removing
the particular file, otherwise select Whole.
Select a directory for the recovered files
Select the path where the recovered files will be stored.
Then press Y.
Some data recovery tools
are:
Ddrescue Data Recovery Tool
SafeCopy
Redo Backup and Recovery
Ultimate Boot CD
THANK
YOU