Like some nights when I can read info I stuck on these info on another linux-forum. Comparing the Linux Fragmentation Vs Windows fragmentation you'll note that it's almost nothing
but the fragmentation exists, lower but is there!
This perl script will show you the fragmentation in the directory you choose (you must use the script as root)
For testing I used it on my home dirCode:#!/usr/bin/perl -w #this script search for frag on a fs use strict; #number of files my $files = 0; #number of fragment my $fragments = 0; #number of fragmented files my $fragfiles = 0; #search fs for all file open (FILES, "find " . $ARGV[0] . " -xdev -type f -print0 |"); $/ = "\0"; while (defined (my $file = <FILES>)) { open (FRAG, "-|", "filefrag", $file); my $res = <FRAG>; if ($res =~ m/.*:\s+(\d+) extents? found/) { my $fragment = $1; $fragments += $fragment; if ($fragment > 1) { $fragfiles++; } $files++; } else { print ("$res : not understand for $file.\n"); } close (FRAG); } close (FILES); print ( $fragfiles / $files * 100 . "% non contiguous files, " . $fragments / $files . " average fragments.\n");So imagine my surpriseCode:root@rommiebox:~# ./fragm.pl /home/seyya 12.2209165687427% non contiguous files, 27.9980415197806 average fragments.and WTF!!
is happening here!! when I see the results. OK I didn't precisely take big care of my file system (reseirfs default) with bittorrents files, managing different images from posters desing to make-ups on photos with my digital camera, huge mp3 collection and fan of radios streammers...then what can i do to defrag my home dir?
Kolivas make a defrag script that is the anwer![]()
Please read the README carefully. Note if you use lilo as your loader and you defrag the partition containing your kernel you will need to rerun lilo before rebooting!Before defrag script: 12.2209165687427% non contiguous files, 27.9980415197806 average fragments
After defrag script: 2.31055414137458% non contiguous files, 1.18778147640493 average fragments
Honestly I don't notice any difference and if not for the script I wouldn't have know my fragment situation, I take this tip like 'It changes nothing except you know that theorically it works better now"
More information HERE
The script it's not mine, I put the information here for knoppix user who has a hd-install

16GB KIT (2x8GB) DDR3 Gamer Desktop RAM PC3 MIXED BRANDS VIPER VENGEANCE FURY
$10.00
Crucial 32GB(4 x 8GB) CT8G4DFS824A.C8FDD1 DDR4-2400 UDIMM Desktop RAM - CR352A
$89.95
Netac DDR4 32GB 16GB DDR4 3200MHz UDIMM C16 Desktop Internal Memory RAM Kit
$99.99
Samsung 32GB DDR4-2666 PC4-21300 288-Pin DIMM RAM M393A4K40CB1CRC0Q
$185.00
Micron 16GB (2x8GB) 2Rx8 DDR3 1600MHz PC3-12800U Desktop RAM
$19.99
Major Brand 16GB (2x8GB) PC3-12800U DDR3-1600MHz DDR3-12800 DESKTOP RAM NON-ECC
$29.99
DDR4 Laptop RAM 4GB 8GB 16GB 32GB 2400 2666 3200 Samsung Hynix
$66.00
A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G
$21.68
Dell 16GB PC4-21300 (DDR4-2666) Memory (SNPPWR5TC16G)
$89.99
Lot of 5 - Mixed Brands 40GB (5x8GB) DDR4-2666 PC4-21300 SO-DIMM 260-Pin Non-ECC
$150.00