You are on page 1of 24

BITS Pilani

presentation
BITS Pilani Sourish Banerjee
WILP
Pilani Campus
BITS Pilani
Pilani Campus

Data Storage Technologyand Networks (Merged - CSIZC446/ESZC446/ISZC446/SSZC446)

CS 04
Books

T1 Storage Networking-Real World Skills for the CompTIA Storage+ Certification


and Beyond by Nigel Poulton, Publishers, SYBEX a Wiley brand, 2015

T2 Storage Networks Explained – by Ulf Troppens, Wolfgang Muller-Freidt,


Rainer Wolafka, IBM Storage Software Development, Germany. Publishers:
Wiley

R1 Storage Networks: The complete Reference, Robert Spalding TMH.


R2 Web resource : http://www.snia.org

BITS Pilani, Pilani Campus


Filesystem Fragmentation

• The kind of fragmentation that OS-based defrag tools, such as those


found in Microsoft Windows, work to resolve is called filesystem
fragmentation.

• Filesystem fragmentation occurs when files do not occupy


contiguous addresses within the filesystem.

BITS Pilani, Pilani Campus


Filesystem Fragmentation

BITS Pilani, Pilani Campus


Defragmenting a Filesystem

• To defrag this filesystem, the defrag tool will use the free
extents as a working area, or swing space, to reshuffle
the extents around until files are represented in the
filesystem as contiguously as possible.

BITS Pilani, Pilani Campus


Defragmenting a Filesystem

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Start A B C D X Y Z E F G M N O P

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A B C D Y Z E F G M N O P X

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A B C D E Y Z F G M N O P X

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A B C D E Y Z X F G M N O P

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A B C D E X F G M N O P Y Z

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Intermediat A B C D E F G X M N O P Y Z
e satges of
defragmenta 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
tion A B C D E F G X Y Z M N O P

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Final State A B C D E F G X Y Z M N O P

BITS Pilani, Pilani Campus


BITS Pilani, Pilani Campus
Disk Fragmentation

• Disk fragmentation occurs when a file,


X
which might be totally unfragmented in the
filesystem, is fragmented on the disk.
A1, B1, C1, D1, E1, J1,K1,L1

• It does not occupy contiguous sectors and FS Contoller


A1 >> P1 (CHS)
A2 >> P2 Ap1
tracks, and as such, accessing the file
incurs rotational latency and seek time that AP1 AP2 AP3 AP4 AP5 AP6 AP7
X

would not be necessary if the file was laid


out contiguously on disk.
• Disk fragmentation can naturally occur,
and especially as a disk drive gets older
and starts to encounter bad blocks that
have to be remapped.

BITS Pilani, Pilani Campus


Disk Fragmentation

• Let’s assume you have an 8K write to disk and there are sixteen free
contiguous sectors (each 512 bytes).
• Ordinarily, an 8K write to this disk would result in the data being
written to those sixteen contiguous sectors.

• However, if when writing the data to disk, one of these sectors is


found to be bad—that is, data cannot be written to it—that sector will
have to be remapped to elsewhere on disk.

• What you end up with is an 8K file written to fifteen contiguous


sectors and a single noncontiguous sector in some other random
location on disk.

BITS Pilani, Pilani Campus


Wear leveling of SSDs

• Wear leveling is the process of distributing the workload


across all flash cells so that some don’t remain youthful
and spritely, while others become old and haggard.

• There are two common types of wear leveling:

• Background wear leveling

• In-flight wear leveling

BITS Pilani, Pilani Campus


In-flight(Dynamic) wear leveling

• In-flight(Dynamic) wear leveling silently redirects


incoming writes to unused areas of flash that have been
subject to lower P/E (Program / Erase) cycles than the
original target cells.

• The aim is to make sure that some cells aren’t unduly


subject to higher numbers of P/E cycles than others.

BITS Pilani, Pilani Campus


Background wear leveling

• Background (static) wear leveling is a controller based housekeeping task.

• This process takes care of the flash cells that contain user data that doesn’t
change very often (these cells are usually off-limits to in-flight wear leveling).

• Background wear leveling is one of those tasks that has to be finely balanced
so that the wear leveling itself doesn’t use too many P/E cycles and shorten
the life expectancy of the device.

BITS Pilani, Pilani Campus


P/E Cycles
• An SSD write cycle is the process of programming data to a NAND flash
memory chip in a solid-state storage device.

• A block of data stored on a flash memory chip must be electrically erased


before new data can be written, or programmed, to the solid-state drive
(SSD).

• The SSD write cycle is also known as the program/erase (P/E) cycle.

• When an SSD is new, all of the blocks are erased and new, incoming data
is directly written to the flash media.

https://searchstorage.techtarget.com/definition/write-
cycle#:~:text=An%20SSD%20write%20cycle%20is,a%20solid%2Dstate%20storage%20device.&te
xt=The%20SSD%20w rite%20cycle%20is,written%20to%20the%20flash%20media.
BITS Pilani, Pilani Campus
P/E Cycles
• Once the SSD has filled all of the free blocks on the flash storage media, it
must erase previously programmed blocks to make room for new data to be
written.

• The SSD controller periodically erases the invalidated blocks and returns
them into the free block pool.

• The background process an SSD uses to clean out the unnecessary blocks
and make room for new data is called garbage collection.
• The garbage collection process is generally invisible to the user, and the
programming process is often identified simply as a write cycle, rather than a
write/erase or P/E cycle
https://searchstorage.techtarget.com/definition/write-
cycle#:~:text=An%20SSD%20write%20cycle%20is,a%20solid%2Dstate%20storage%20device.&te
xt=The%20SSD%20w rite%20cycle%20is,written%20to%20the%20flash%20media.
BITS Pilani, Pilani Campus
Journaling File System
Refer to ext3 and above

• The ext3 filesystem, developed by RedHat extends the popular ext2


filesystem with the introduction of journaling.

• A journaling filesystem keeps a journal or log of the changes that are being
made to the filesystem during disk writing that can be used to rapidly
reconstruct corruptions that may occur due to events such a system crash
or power outage.

• The level of journaling performed by the file system can be configured to


provide a number of levels of logging depending on your needs and
performance requirements.

https://www.linuxtopia.org/HowToGuides/ext3JournalingFilesystem.html#:~:text=A%20journaling
%20filesystem%20keeps%20a,system%20crash%20or%20power%20outage. BITS Pilani, Pilani Campus
Advantages of a Journaling
Filesystem
• The problem with a non-journaled file system is that following a crash the fsck
(filesystem consistency check) utility has to be run.

• “fsck” will scan the entire filesystem validating all entries and making sure that
blocks are allocated and referenced correctly. If it finds a corrupt entry it will
attempt to fix the problem.

• The issues here are two-fold.

• Firstly, the fsck utility will not always be able to repair damage and you will
end up with data in the lost+found directory. This is data that was being used
by an application but the system no longer knows where they were reference
from.

• The other problem is the issue of time. It can take a very long time to
complete the fsck process on a large file system leading to unacceptable
https://www.linuxtopia.org/HowToGuides/ext3JournalingFilesystem.html#:~:text=A%20journaling
down time. %20filesystem%20keeps%20a,system%20crash%20or%20power%20outage. BITS Pilani, Pilani Campus
Advantages of a Journaling
Filesystem
• A journaled file system records information in a log area on a disk (the journal and
log do not need to be on the same device) during each write. This is a essentially an
"intent to commit" data to the filesystem.

• The amount of information logged is configurable and ranges from not logging
anything, to logging what is known as the "metadata" (i.e ownership, date stamp
information etc), to logging the "metadata" and the data blocks that are to be written
to the file.

• Once the log is updated the system then writes the actual data to the appropriate
areas of the filesystem and marks an entry in the log to say the data is committed.

• After a crash the filesystem can very quickly be brought back on-line using the
journal log reducing what could take minutes using fsck to seconds with the added
advantage that there is considerably less chance of data loss or corruption.
https://www.linuxtopia.org/HowToGuides/ext3JournalingFilesystem.html#:~:text=A%20journaling
%20filesystem%20keeps%20a,system%20crash%20or%20power%20outage. BITS Pilani, Pilani Campus
Disadvantages of a Journaled
Filesystem
• The biggest draw back of journaling is in the area of performance simply
because more disk writes are required to store information in the log.

• In practice, however, unless you are running system where disk


performance is absolutely critical the performance difference will be
negligible.

https://www.linuxtopia.org/HowToGuides/ext3JournalingFilesystem.html#:~:text=A%20journaling
%20filesystem%20keeps%20a,system%20crash%20or%20power%20outage. BITS Pilani, Pilani Campus
Start here on 19th

BITS Pilani, Pilani Campus


Journaling Options are Available
with the ext3 filesystem
• The ext3 filesystem provides three options. These are as follows:

• writeback - greater speed at the price of limited data integrity. Allows old
data to show up in files after a crash and relies on kernel's standard
writebacks to flush buffers.

• ordered - that the data is consistent with the file system; recently-
written files will never show up with garbage contents after a crash at
the cost of some speed.

• journal - Journals all data requiring greater journal space and reduced
performance. The most secure data retention policy.
https://www.linuxtopia.org/HowToGuides/ext3JournalingFilesystem.html#:~:text=A%20journaling
%20filesystem%20keeps%20a,system%20crash%20or%20power%20outage. BITS Pilani, Pilani Campus
tune2fs

• tune2fs allows the system administrator to adjust various


tunable filesystem parameters on Linux ext2, ext3, or ext4
filesystems.
• Set Volume Label
tune2fs -L "home" /dev/sda1
• List Parameter Values
tune2fs -l /dev/sda1
• Time Dependent Checking
tune2fs -i 10d /dev/sda1
• Change Max Mount and Mount Count
tune2fs -c 20 /dev/sda1
• Set Last Time Check
tune2fs -T now /dev/sda1
• Convert Filesystem Type using -j
tune2fs -j /dev/sdb1

• Set Filesystem Features: use -O option to convert ext3 to ext4 file


system as shown below.
tune2fs -O extents,uninit_bg,dir_index /dev/sda2
https://linux.101hacks.com/unix/tune2fs/
BITS Pilani, Pilani Campus
Disable/enable journaling
• STEP 1: Unmount the file system • STEP 4: Reboot
partition journaling you want to disable • STEP 5: Verify that the file system has
• umount <mount point> journaling disabled and the partition is
• STEP 2: Disable journaling for the file mounted
system • After the host has rebooted, you
• Use the following command to may use the following commands to
disable/enable journaling for an check if journaling is disabled for the
ext4 file system: filesystem and the partition is
mounted:
• tune4fs -O ^has_journal /dev/sda2
• dmesg | grep EXT4
• STEP 3: Perform a file system check
• Expected output similar to: EXT4-fs
• Use the following command to
(dm-3): mounted filesystem without
perform a file system check.
journal
e4fsck –f /dev/sda2
• df -h

https://foxutech.com/how -to-disable-enable-journaling/
BITS Pilani, Pilani Campus
BITS Pilani, Pilani Campus

You might also like