I am not sure how often fragmentation happens on Linux but I was recommended by someone (I work with) to defrag it. He is an iOS user though so I am not sure why he’d recommend it. I am getting mixed information doing my own research. Some say it isn’t needed, others say you can do it if you want. I am wondering how to actually do it though. Does anyone know how to defrag Linux?
Interesting question. I searched and probably read sites you did. A program called e2fsck (not sure how it differs from plain old fsck) reports non contiguous blocks, so you can get an idea how bad your problem is. This page shows the syntax for e2fsck.
I won’t recommend a defrag program, as I haven’t ever needed one, and I know nothing more than today’s reading. The page I linked provides details on how to defrag, but I recommend studying up; low level operations like this are definitely “measure twice and cut once” operations.
I would agree. I’ve never completed a defrag in Linux, ever.
I would say buying a cheap SSD is the solution. Defrag is more a windows thing. If you have an SSD installed you don’t need to defrag. Instead, you will add TRIM.
See this article which I need to update but most is still valid:
To answer the question, for Linux to defrag you refer to some of these links:
- Start here: Why Linux Doesn’t Need Defragmenting
- DiskFreeSpace - Debian Wiki
- System maintenance - ArchWiki
- Beginning Ubuntu Linux: Natty Narwhal Edition - Emilio Raggi, Keir Thomas, Sander van Vugt - Google Livres
- Chapter 2. File System Structure and Maintenance Red Hat Enterprise Linux 6 | Red Hat Customer Portal
Defragging Linux is almost never needed. Only in very niche scenarios would you ever want to do this.
As mentioned, it is more of a Windows thing and something most (99%) Linux users do not have to concern themselves with.
You have the information on why it isn’t needed and more. If you have any other questions, just ask here. I am sure someone can help.