Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I find this to be some what funny, because I asked that same question when I first made my transition to Linux. If your harddrive is Formated under linux file system, such as ext2, ext3, ext4... or other linux variants, fragmentation does not occur because at the time that a file is created, it also allocates additional space for future changes, which actually keeps the file in location. If your system is acting slow, there may be other causes... such as a process taking
up all your memory, a program that didn't install properly, low system memory, or last... failing Hard Drive. Hope this helps.
I have noticed that with kernels 3.10.x and newer, they've changed something in filesystem or file handling that really does make defragmenting obsolete. There are plenty of scripts out there that can defragment, and I do use one, but with kernel 3.10.x it doesn't need to defrag anything, because it seems to be done automatically, or at least file placement is such that it is not needed.
So, I would agree that it is no longer needed with newer kernels.
There hasn't been any need to defragment disks since version 1... and the Ext2 filesystem.
What happens is that the disk uses a more optimum allocation that minimizes fragmentation.
Fragmentation only becomes an issue if you operate the filesystem for long periods of time at 98% capacity or higher.
By default, Linux native filesystems prevent that (well, reduce the occurance) by reserving 10% of the disk capacity for the root user, and being able to relocate blocks itself. This allows a reasonable overhead that minimizes the impact of fragmentation (it keeps it under around 1.5%). The 10% amount is only a default, it can be tuned for TB filesystems (where 10% is 10G) and set to 1% for such filesystems (see tunefs).
Some of the newer filesystems (btrfs, ext4fs) have an internal defragmenter that does optimize storage, but it isn't necessary to invoke it as it is built in. There are commands to defragment, but I believe these are just passed to the filesystem code to reallocate data.
The only time things got a bit dicey for me was when I filled the disk... Cleanup, get the free space down to 40/50 percent, and the fragmentation takes care of itself.
In my case, it was the root filesystem - and it was the logs that filled it. As the fragmented logs were deleted (age), the recovered space was no longer fragmented. I just needed to keep up with the logs better...