LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-29-2012, 12:58 AM   #1
niri
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
What's the best way to defrag ext3?


Hi,

I have a web server with centos 5.8.

There are many fragmented files, for example:
Code:
# filefrag /home3/files/ZSPNIMTLS2EVSX14ZU2RJYPEX0HU42JGCOJU.avi
/home3/files/ZSPNIMTLS2EVSX14ZU2RJYPEX0HU42JGCOJU.avi: 226 extents found, perfection would be 6 extents

# filefrag /home3/files/YEUBCBYNY02E4VT2ODWUCTAJAY5WVSSGXEEK.avi
/home3/files/YEUBCBYNY02E4VT2ODWUCTAJAY5WVSSGXEEK.avi: 222 extents found, perfection would be 6 extents

# filefrag /home3/files/VMV2SOC3OP0DAVUG1DTIFPX5VHQSPPED4331.avi
/home3/files/VMV2SOC3OP0DAVUG1DTIFPX5VHQSPPED4331.avi: 224 extents found, perfection would be 6 extents
How to reach perfection state?
Currently I get very poor HDD throughput.

Thanks
 
Old 11-29-2012, 06:35 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
see here: http://en.wikipedia.org/wiki/Ext3#Defragmentation
 
1 members found this post helpful.
Old 11-29-2012, 09:05 AM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello niri, welcome to LQ,

if you want to defrag a filesystem, you should use Windows.

Markus
 
1 members found this post helpful.
Old 11-29-2012, 03:21 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
defragment

EXT filesystems (and most Linux file systems in general) defragment themselves over time. That said, if you use the storage in such a way as to promote fragmentation, moving to EXT4 with delayed allocation seems to help a LOT. On a busy system it reduces fragmentation during new file creation dramaticly, and fragmentation has less impact on performance than it does with EXT3.

There are newer file systems that should have even better properties, but they do not seem quite ready. Yet.

I suspect that your storage performance issues may not be due to fragmentation, but it would take a significant effort to test enough to be sure.
 
1 members found this post helpful.
Old 11-29-2012, 05:45 PM   #5
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
The easiest way I know of defragmenting ext3, not that it needs it anyway, is to copy the entire system to another drive and then copy it back. The writing process automatically puts the file fragments in their corerct position. I have a system running Debian Sid here and its fragment status is 0.2% I wouldn't think that is an issue.
 
Old 11-29-2012, 06:41 PM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Your best solution, in my opinion, would be to combine the suggestions in the two prior posts (#4 and #5), by copying the ext3 file system into an ext4 one, and using the new ext4 one to replace the old one. Note, however, that you cannot copy system files (/dev, /proc, etc.) and expect things to keep working. (rsync can be used for system files. In fact, consider changing your file system to ext4 and then just restoring the files from your back-ups.) IIRC, you can convert an ext3 file system to an ext4 on "on the fly," but - if I were to attempt that - I'd make sure that I had at least two working back-ups. . .
 
Old 11-29-2012, 07:49 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
The old way was to back up to tape as in tar and replace the data. Still works.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ext3 defrag terfy Linux - General 22 01-11-2012 03:55 PM
USB Hardrive with FAT32 and ext3 partitions in need of repair/defrag MiniDev Linux - Hardware 6 02-15-2008 03:05 PM
Defrag (NOT for ext2/ext3, for FAT32 partitions) Red Barchetta Linux - Software 2 03-31-2007 07:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration