Is there any disk defragmenting GUI like piriform's Defraggler for Linux?
I'm looking for a tool that can give me a visual representation of my ext4 fragmentation. Something similar to how Defraggler, Puran Defrag, and many others (UltraDefrag being the best) display your disk... (most good UIs display the files in the block you're hovering your mouse over)
Is there anything related for Linux?
I want to watch my disk and see just how "unneeded" defragmentation really is.
I don't want to use e4defrag, because I'm not sure it can show me what exactly it's doing to my disk.
EDIT (2021): it would seem a similar, less popular, question has been asked 3 years before this question with suggested tools: https://unix.stackexchange.com/questions/30743/is-there-a-tool-to-visualize-a-filesystem-allocation-map-on-linux
Solution 1:
The question is not if there is fragmentation. All file systems have some fragmentation.
The question is if the fragmentation is enough to affect performance.
On Linux file systems, fragmentation is typically less then 5%, often 1 or 2% unless the disk is 99% full. In the event of a full disk, you can see significant fragmentation, but in that case the problem is a full disk.
$ sudo fsck.ext2 -fn /dev/sda1
e2fsck 1.42 (29-Nov-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Ubuntu_Rescue: 291595/1222992 files (**0.2% non-contiguous**), 1927790/4882432 blocks
So yes, there is 0.2 % fragmentation, but this is well below the 85% threshold to affect performance.
See the blog post Why doesn't Linux need defragmenting?.
On Windows, it is not uncommon to see 50% or higher rates of fragmentation (I have seen 200% plus). Thus windows needs defragmentation tools.
On Windows they advise defragmentation at thresholds of about 85%.
See:
- Defragging: Why, How, and Whether
- The Biggest Disk Defragmentation Myths
So, bottom line, defragmentation is not a large enough problem on Linux to affect performance, so there are no significant defragmentation tools and you are sort of wasting your time worrying about it.
Solution 2:
Let's keep it simple...
1) If you use EXT4, there is no need to defrag unless your disk is ~90% full and under heavy IO (Delete, Read, Write).
2) If you find yourself with a ~90% full disk that is heavily fragmented, then your problem is (IMHO) insufficient disk space and not fragmentation. Get a larger disk!
3) If you can't get a larger disk for any valid reason, then simply copy the whole lot (or by large chunks) to another disk, then copy it back. The advanced EXT4 FS writes it back contiguously eliminating fragmentation. This can be scheduled as a cron.daily job using Gnome Scheduler for the converts coming from Windows.
BEST FIX if you have the problem from point 2 above, get a larger disk!
Solution 3:
There is no need for defragmentation on Linux systems.
So that is why there are not many defrag tools available.