LinuxQuestions.org
Visit the LQ Articles and Editorials section
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, 01: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, 07:35 AM   #2
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,152

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

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
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, 04:21 PM   #4
wpeckham
Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix
Posts: 832

Rep: Reputation: 181Reputation: 181
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, 06:45 PM   #5
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,899

Rep: Reputation: 623Reputation: 623Reputation: 623Reputation: 623Reputation: 623Reputation: 623
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, 07:41 PM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
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, 08:49 PM   #7
jefro
Guru
 
Registered: Mar 2008
Posts: 12,087

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
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


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


All times are GMT -5. The time now is 06:01 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration