-
Defrag for linux?? Oh Yeah!
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)
Code:
#!/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");
For testing I used it on my home dir
Code:
root@rommiebox:~# ./fragm.pl /home/seyya
12.2209165687427% non contiguous files, 27.9980415197806 average fragments.
So imagine my surprise
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
Before defrag script: 12.2209165687427% non contiguous files, 27.9980415197806 average fragments
After defrag script: 2.31055414137458% non contiguous files, 1.18778147640493 average fragments
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!
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
Similar Threads
-
By blokk.m in forum Hdd Install / Debian / Apt
Replies: 9
Last Post: 10-01-2009, 03:17 AM
-
By Jonah in forum Hdd Install / Debian / Apt
Replies: 2
Last Post: 05-27-2009, 05:55 PM
-
By Jakykong in forum The Lounge
Replies: 2
Last Post: 12-14-2005, 08:36 AM
-
By bob58 in forum General Support
Replies: 0
Last Post: 04-02-2004, 04:46 AM
-
By thewretchedbeaver in forum Customising & Remastering
Replies: 7
Last Post: 02-05-2003, 01:36 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot
$285.90

24x Micron MT40A512M16LY-062E IT:E 8Gb DDR4-3200 96-FBGA Memory IC
$349.99

24x Micron MT40A512M16LY-062E IT:E 8Gb DDR4-3200 96-FBGA Memory IC
$349.99

Dell 16GB PC4-21300 (DDR4-2666) Memory (SNPPWR5TC16G)
$89.99

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack
$826.09

Transcend 96GB (6x16GB) 2Rx8 PC4-2666V DDR4 ECC UDIMM Server RAM TS2GLH72V6B
$299.00

Samsung 32GB DDR4-2666V-2Rx4-RB2-12 RAM M393A4K40CB2-CTD6Q
$169.00

USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot
$3.75

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot
$573.98

Samsung Planet First 8GB 2Rx4 PC3-10600R
$341.00