Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So I just found the command filefrag. I thought I'd see if any of my files are fragmented. I have quite a few large files, [500MB/+] and every single one I've tried has 5 to 42 extents found.

What's going on? I have EXT4, and I have 185G of 515G free [63% used].

I thought EXT3 and EXT4 didn't fragment files [unless absolutely necessary]. I did restore all my files actually, from a NTFS partition [My ext. hdd is NTFS. I've thought about formatting it to EXT, but it's 0.5TB and would take a long time to recopy my files] after I switched to a new laptop a week ago.

So how do I defragment these files, and why are they fragmented?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

On the subject of extents:

Extents replace the traditional block mapping scheme used by ext2/3 filesystems. An extent is a range of contiguous physical blocks, improving large file performance and reducing fragmentation. A single extent in ext4 can map up to 128 MiB of contiguous space with a 4 KiB block size.

(from wikipedia)

128 Mb per extent gives about 4 extents per 500Mb file for absolutely the best possible scenario. Are your "more fragmented" files in 5Gb size range? Also, this doesn't necessary mean you have that many non-continuous regions... extents may follow each other on disk.

I believe fragmentation is an issue when you have thousands of non-continuous regions each of which is a few kilobytes in size. If your extents are many tens or hundreds of megabytes in size any effects on performance are negligible. Relax.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.