Fragmentation Of The Ext4 File System In Ubuntu

DIFFERENCE BETWEEN WINDOWS AND GNU/LINUX

“Data in the computer is stored in files that are written on the hard disk which is like a giant closet with millions of drawers and each drawer has the same capacity (usually 512 bytes). If the data is stored in contiguous drawers, it can be accessed faster than if it was in a discontinuous (fragmented) order into the closet. So far, it is understood that “issues” can be found faster in an ordered closet than in a messy one. The problem is to know how to keep the closet organized when it is frequently used.”

(Extracted from an exterior article).

Now think about an organization that retains its information in an enormous closet with hundreds of thousands of drawers. The aim is to have all of the paperwork regarding the identical file in adjoining bins. The firm wants to rent a secretary. There are two candidates:

The first candidate (Windows) works as follows: when a file is deleted from the file, merely empty the drawers; when a brand new file must be entered, she separates it into small teams of paperwork with the dimensions of a drawer (512 bytes), and archives every group randomly, within the first empty drawer within the closet. Sooner or later it can turn out to be very tough to rapidly discover all paperwork associated to a file and the corporate should rent, each weekend, a dozen assistants to place all the things again so as.

The second (GNU / Linux), retains an inventory of contiguous empty drawers on her desk, which is up to date each time a file is closed and faraway from the drawers. When a brand new file is entered, it searches its listing for a set of contiguous empty drawers as crucial, and that’s the place she locations the brand new document. So the cupboard will at all times be tidy, despite the fact that there are various information actions.

KNOWING THE FRAGMENTATION LEVEL IN A GNU/LINUX SYSTEM

How can the person know the defragmentation an ext4 file system has in Ubuntu or any GNU/Linux?

It’s a easy technique that may let the person understand how fragmented is the file system,

Warning:

DO NOT RUN FSCK COMMAND ON MOUNTED PARTITION as this may occasionally injury the file system. There could also be an utility working with the recordsdata, because it normally occurs with mounted partitions.

To do that safely, it’s best to start out in Live-CD mode (with out altering the pc) or from one other Linux partition (if exists) and open a Terminal.

Users can see partitions are put in put in in Ubuntu with the next command:

sudo fdisk-l

The terminal will return one thing like this:

/dev/sda1 * 1 12748 102398278+ 7 HPFS/NTFS /dev/sda2 12749 60802 385988219+ 5 Extendida /dev/sda5 60316 60802 3905536 82 Linux swap / Solaris

/dev/sda6 55864 60315 35760658+ 83 Linux

Locate the Linux partition that claims 83 for the ID quantity. In this case it’s:

/Dev/sda6

Now see how the filesystem is doing with this command:

sudo fsck.ext4 -vpf /dev/sda6

Where ext4 is the file system that the system has (may also be ext3) and sda6 is the partition the place Ubuntu is put in.

The terminal will return one thing like:

177653 inodes used (7.27%) 197 non-contiguous recordsdata(0.1%) 240 non-contiguous directories(0.1%) # de nodos-i con bloques ind/dind/tind: 0/0/0 Extent depth histogram: 137975/93 2545505 blocks used (26.07%) Zero unhealthy blocks 1 massive file 113484 common recordsdata 17973 directories 60 character system recordsdata 26 block system recordsdata Zero fifos 729 hyperlinks 46094 symbolic hyperlinks (39482 quick symbolic hyperlinks) 7 sockets

In this case (proven in purple), the file system has 0.1% of defragmentation, This is from a pc that has a whole lot of functions being put in and eliminated on a regular basis.

DEFRAGMENTATION TOOL FOR GNU/LINUX

Desktop customers don’t want this utility, however will be helpful for servers that deal with a whole lot of info. There is defragmentation utility referred to as “e4defrag” not appropriate for newbies and for now’s solely really useful for consultants. For extra info:

http://polishlinux.org/apps/cli/ext4-defragmentation-with-e4defrag/

Learn more about ext4 partitions in U buntu.



Source by Marcos Aguilar

Leave a Reply

Your email address will not be published. Required fields are marked *