Announcement

Collapse
No announcement yet.

Backing up and restoring a partition to avoid fragmentation

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Backing up and restoring a partition to avoid fragmentation

    Hi everybody.
    This is not a question specifically about Kubuntu, if there is a more appropriate forum for it, LMK.

    I used "partimage" to backup and restore both my ext3 Linux install partition and a ntfs windows partition. The idea is to lower fragmentation by saving the files, formatting the partition and getting them back.
    It's well known that Linux partitions don't fragment as often as Windows, but since I cannot see how it is, I just saved the main partition to a USB disk, formatted and restored everything (by saving the partition, I mean the files in it, since partimage doesn't save stuff like dd). For boot, I don't know if it is a psychological effect, but it looks, looks faster... I may be wrong.
    As for Windows, partimage says the NTFS support is experimental, but I had no problem backing up and restoring the files, with a format between. All was done with GParted in a LiveUSB pendrive.
    When I opened PerfectDisk (the tool I use to defragment NTFS under XP x64) and analysed the disk, the files in the NTFS partition were in the very same place as before the backup and restore, while they should have been moved towards the beginning of the partition.
    If I had backed it up with "dd", then it would be acceptable, since it would just copy the entire partition "as is", but partimage just copies the used space and doesn't seem to store any information about where the files are in the disk, physically.
    If it happened to Windows, then it probably happened to the Linux partition too, so the files were restored to the very same place of the disk as before, thus, not helping with the fragmentation.
    Am I making any wrong assumption? Any wrong procedure? What do you think?

    #2
    Re: Backing up and restoring a partition to avoid fragmentation

    you might want to check how much fragmented your ext3 is, first.

    you can do that by running a file system check (fsck) on the unmounted file system.
    something like so:
    Code:
    fsck -C -f -a -t ext3 /dev/whatever
    of course, you won't be able to run the fsck on your active root file system!

    but you can force a fsck on that one at the next boot simply by doing this
    (there's several other ways of doing it, this is just one of them)
    Code:
    sudo touch /forcefsck
    and you don't have to stare at your screen when the system comes up.
    when the system is up and running you can go and inspect the log file, e.g.:
    Code:
    less /var/log/fsck/checkroot
    hth
    gnu/linux is not windoze

    Comment


      #3
      Re: Backing up and restoring a partition to avoid fragmentation

      Originally posted by DMurray

      I don't know if it is a psychological effect, but it looks, looks faster...

      What do you think?
      It's interesting, that's what I think, but without something more quantitative, it's just a "feeling". I'd love to see someone run some kind of benchmark test on a filesystem that has been used a lot, i.e. that is presumably full of fragmented files, and then, after "defragmenting" run the same benchmark, and let's see whether it's real or psychological.

      Note that I'm not actually smart enough to know what the benchmark test would be ... it seems like it would need to be a series of "file, open" type operations.

      Comment


        #4
        Re: Backing up and restoring a partition to avoid fragmentation

        There would be a slight increase in read times, because it would have the whole file in one place. No need to go seeking all over the platter(s) for one file.
        It's probably not that noticeable, though, like dibl says. Just your suggestable imagination.
        For external use only.

        Comment


          #5
          Re: Backing up and restoring a partition to avoid fragmentation

          I will try what Jankushka suggested, so I can have an idea of the actual fragmentation.
          If it was low at the time I did this backup-format-restore, then the performance gain would not be noticeable, but in a very fragmented disk, it could have a better impact.
          I also don't have a benchmark for harddisk analysis in Linux, and I doubt "hdparm" would be a good reference since it doesn't have a serious test, it's just one of those 10 seconds benchmarks, IMHO.

          Comment

          Working...
          X