How to Defrag in Linux
The files on a hard-disk drive can become fragmented, or written in random blocks. Fragmentation can slow performance, so defragmentation is a common task for PC users. With Linux replacing Windows on the desktops of many users, questions may arise anew as to how to defragment a hard drive. This article will discuss the process of Linux defragging.
- Difficulty:
- Easy
Instructions
-
-
1
A hard-drive platter
A common question from new Linux users is "How do you defrag your hard drive?" The short answer is that you probably don’t have to. The file system on Linux and other UNIX (and UNIX-like) operating systems is organized and stored more efficiently than the one on a Windows PC. On Windows, PC users will not notice a performance dropoff until fragmentation hits 20 percent or more, which is rare; on a multi-user, multi-tasking, multi-threaded operating system like Linux, the fragmentation of files on the hard disk is usually under 1 percent.
-
2
Linux defrag in WIndows
There are a few tools available that will allow you to defrag a Linux hard drive or partition. “EX2 File System for Windows” will let you defrag a Linux Ext2 volumes structure on a dual-boot system (a system partitioned to run both Linux and Windows). Defragmentation of the Linux partition or drive is done from directly within the Windows environment.
-
3
A Linux computer compiling
There is one native solution to defragging a Linux partition or boot drive from directly within Linux. The “Linux File-System Defragmenter” runs only in the command-line environment. The application can be downloaded directly from the SourceForge software depository. To use The Linux File-System Defragmenter, download and expand the tarball and type “make” in the command-line terminal. Use of the utility can be implemented with the command: “#defragfs /mnt/hda1” (without the quotes). Specification of "-f" will also force defragmentation.
-
1
Tips & Warnings
Why mess with a good thing? Linux file systems are efficient enough to not require defragmentation utilities. If it ain’t broke, don’t fix it.
Related Searches
Resources
- Photo Credit stock xchange: barun patro, Christian Fenech, Matthew Bowden, Dominik Rusiecki
Comments
-
genehoffpauir
Jan 13, 2009
I've got a 80 GB hard drive with 25.7 GB free. With Windows I would expect my computer to start slowing down. It still runs just as fast as when I wiped out Windows and installed Linux. I don't see any need to defragment. I am not familiar with source code either. I agree, if it ain't broke, don't fix it! -
genehoffpauir
Jan 13, 2009
I've got a 80 GB hard drive with 25.7 GB free. With Windows I would expect my computer to start slowing down. It still runs just as fast as when I wiped out Windows and installed Linux. I don't see any need to defragment. I am not familiar with source code either. I agree, if it ain't broke, don't fix it! -
stuuf
Jan 08, 2009
IF you use XFS you can use the xfs_fsr program to live-defragment filesystems. -
stuuf
Jan 08, 2009
IF you use XFS you can use the xfs_fsr program to live-defragment filesystems.