-
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

Broadcom LSI 9305-16i 12Gbps SAS-3 PCIe x8 HBA 16-Ports Raid Controller
$64.99

Dell PERC H810 1GB NV Cache External SAS RAID 0VV648 w/ Battery Full Height
$21.99

G-Technology G-SPEED Studio XL 48TB Thunderbolt 2 Storage - Housing Only
$200.00

HP controller P3410-69003 NetRAID-1M SCSI 64-bit U160 32MB Cache (PCI)
$359.00

HP 660088-001 SAS9205-8i 6GB/s SAS SATA HBA Raid Controller Adapter Card PCIe3
$20.00

LSI 9305-16i SATA SAS 12Gbs Controller card PCIe 3.0 IT-Mode w/SAS SATA cable US
$106.67

MegaRAID 9580-8i8e 16-port 12G SAS/SATA/NVMe 8GB PCIe RAID - 05-50076-00
$1619.30

OWC Mercury Elite Pro 2 Bay RAID Enclosure with USB 3.2 for Dual 3.5 inch HDDs
$87.99

9300-8i LSI SAS3008 8-Port 12Gb PCIe IT mode ZFS FreeNAS unRAID 2*SFF-8643 US
$49.50

Dell PowerVault MD3000i AMP01 Storage Array 2x PSUs No HDDs/Controllers/Caddies
$144.95