Allegato "fragck.pl"
Scarica 1 #!/usr/bin/perl -w
2
3 #this script search for frag on a fs
4 use strict;
5
6 #number of files
7 my $files = 0;
8 #number of fragment
9 my $fragments = 0;
10 #number of fragmented files
11 my $fragfiles = 0;
12
13 #search fs for all file
14 open (FILES, "find -xdev -type f |");
15
16 while (defined (my $file = <FILES>)) {
17 #quote some chars in filename
18 $file =~ s/!/\\!/g;
19 $file =~ s/#/\\#/g;
20 $file =~ s/&/\\&/g;
21 $file =~ s/>/\\>/g;
22 $file =~ s/</\\</g;
23 $file =~ s/\$/\\\$/g;
24 $file =~ s/\(/\\\(/g;
25 $file =~ s/\)/\\\)/g;
26 $file =~ s/\|/\\\|/g;
27 $file =~ s/'/\\'/g;
28 $file =~ s/ /\\ /g;
29 #nb of fragment for the file
30 open (FRAG, "filefrag $file |");
31 my $res = <FRAG>;
32 if ($res =~ m/.*:\s+(\d+) extents? found/) {
33 my $fragment = $1;
34 $fragments+=$fragment;
35 if ($fragment > 1) {
36 $fragfiles++;
37 }
38 $files++;
39
40 } else {
41 print ("$res : not understand for $file.\n");
42 }
43 close (FRAG);
44 }
45 close (FILES);
46
47 print ( $fragfiles / $files * 100 . "% non contiguous files, " . $fragments / $files . " average fragments.\n");
Allegati
Per riferirsi agli allegati di una pagina, usare attachment:NOME_FILE, come mostrato qui sotto nell'elenco degli allegati. NON usare l'URL che si trova in corrispondenza del collegamento [scarica], potrebbe cambiare in futuro.Non รจ consentito inserire allegati su questa pagina.