Professional Documents
Culture Documents
CS 4
CS 4
presentation
BITS Pilani Sourish Banerjee
WILP
Pilani Campus
BITS Pilani
Pilani Campus
CS 04
Books
• 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.
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
• 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.
• 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.
• 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
• 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.
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.
• 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.
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
• 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
https://foxutech.com/how -to-disable-enable-journaling/
BITS Pilani, Pilani Campus
BITS Pilani, Pilani Campus