LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack 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
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,001

Rep: Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003Reputation: 1003
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,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
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
Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix
Posts: 739

Rep: Reputation: 169Reputation: 169
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 Slackware 14.
Posts: 2,453

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
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,141

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
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
Guru
 
Registered: Mar 2008
Posts: 10,255

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration