defrag for ext3

Help
2005-02-06
2012-11-28
  • Mario Lipinski

    Mario Lipinski - 2005-02-06

    Hello,

    i tried to defrag my ext3 partition with the e2defrag from a few years ago. it was a big failure... i cannot mount it anymore as ext3 and i also cannot convert it to ext2 back. mounting as ext2 seems to work well so there is no data lost. can i revert somehow without backing up all files and formating the partition?

    is there a working defrag for ext3 available or to i have to convert from ext3 to ext2 everytime before defragmenting?

    Thx in advance,
    Mario

     
    • Theodore Ts'o

      Theodore Ts'o - 2005-02-06

      What sort of error are you getting when you try to convert it back to ext2?  And how are you trying to do it?  

      What sort of error do you get when you try to mount it as an ext3 filesystem?

      I'm a little surprised that e2defrag didn't work with ext3, but keep in mind that e2defrag has essentially been unmaintained for quite a number of years now.  (It is NOT part of e2fsprogs.)   The main resaon for it is (a) it is quite a dangerous problem; the documentation states that you should do a backup first, since if you crash while e2defrag is running, the probability that all of your data will be scrambled is quite high; (b) if you do have to do a backup first, the time it takes to do a backup, reformat, and restore is not that much different from the time it takes to do a backup followed by an e2defrag run, and (c) in general, the ext2/ext3 filesystems have block allocation algorithms which resist fragmentation far better than, say, FAT filesystems.  So at this point, with a few rare exceptions, the need for a defragmenter is more to keep DOS refugees happy than any fundamental need. 

      In any case, it would be good to see what is going on.  I'm sure it is possible to recover your filesystem; at the worst you might have to use debugfs and manually clear the has_journal feature flag, and manually clear the journal inode.  But before we do that, I'd like to see what e2defrag had done to your filesystem

       
    • Mario Lipinski

      Mario Lipinski - 2005-02-07

      before this post i tried everything from a knoppix 3.7 cd - a system running from cd.

      now i unmounted the partition in the running system and made a "tune2fs -O ^has_journal /dev/hda8" which worked here. on the cd system tune2fs segfaulted. on the cd there was a quite current version of e2fsprogs installed. on my working system i have e2fsprogs of 27-Jan-2005.

      when i tried to mount the partition as ext3 the error was something like the journal inode was deleted.

      (a),(b): I agree that doing a backup before defragmenting is not very effective.

      (c): Well, there a some sources which says, that also ext2/3 file systems get fragmented. i belived them by now. fsck by examplate also states XX % not contignous. so i think there is fragmentation on ext2/3 on often used file systems. especially when there get files bigger of replaced by other ones. So is there really no gain in performance after doing defrag?

      i am just having a look if i get my partition again to a ext3 one and the i will see wheter i can reproduce the error also on my working system.
      however, if you are interested in any information, i think i can reproduce that.

      Thx,

      Mario

       
      • Mario Lipinski

        Mario Lipinski - 2005-02-07

        sry for not posting last post as follow-up. just noticed after submitting.

        after trying again using e2defrag Version 0.73pjm1 (30 Apr 2001) with a ext3 partition i can say that this does not work for me.
        the filesystem is left in an inconsistent state.

        - e2defrag displays bad  blocks
        - after e2defrag is done i cannot start it again (some wrong counts)
        - fsck outputs lots of errors (wrong block for inode and other)
        - after doing "tune2fs -O ^has_journal" fsck runs nearly fine and e2defrag runs without problems

        everytime before running defrag i did fsck (-f) and there where no errors.

         

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks