Defrag Single File Linux ext3

lambchops511

Senior member
Apr 12, 2005
659
0
0
Sorry if wrong section.

I have a relatively (50G) large file on ext3, I need good linear access / bandwidth times on it. Is there a way to "defrag", the way it was copied over to the server I am pretty sure was fragmented pretty badly. I don't need perfect defrag, but is there a good way to make the file "less fragmented"?

Would a something simple like

cp my_file /tmp/garbage
rm my_file
mv /tmp/garbage my_file

do the magic?
 

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
Tried defrag?

There's also shake, which is probably better.

Also, yeah, this should probably go under *nix Software.
 

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
WOW! THANKS! I did not know this command. Is 86 extents good / bad for a 30 G file? I am guessing its pretty good? That probably means if I want better IO perf I need to hit SSDs?
Yes. Generally, anything above around 50MB/fragment is, "good enough," and that's over 300MB/fragment. Even with some tiny fragments mixed in there, that's good enough to just not worry about it. Any newish HDD (500GB/platter or denser) aught to be able to read such a file at 100MB/s, no sweat.
 

mfenn

Elite Member
Jan 17, 2010
22,400
5
71
www.mfenn.com
Yes. Generally, anything above around 50MB/fragment is, "good enough," and that's over 300MB/fragment. Even with some tiny fragments mixed in there, that's good enough to just not worry about it. Any newish HDD (500GB/platter or denser) aught to be able to read such a file at 100MB/s, no sweat.

Agree.

OP, the -v output from filefrag lists all the file's extents along with their length (5th column). Double-check to make sure that there aren't a bunch of really tiny extents, but you are most likely OK.