Defrag Software

James Wilkinson ubuntu at westexe.demon.co.uk
Fri May 20 12:14:06 UTC 2005


Vincent Trouilliez wrote:
> Good point ! I remember Windows needing 2 hours to defrag a small 8GB
> hard drive. A *nix server with dozen of tera bytes of disk space and
> frequent disk access, say databases, would probably be down 90% of it's
> time if it had to defrag !

For what it's worth, you don't need to defrag database filesystems on
any OS. At least not if they're competently administered.

Most commercial databases need a set of disks for performance reasons.
The one I look after at work has a RAID 10 across ten disks [1], and
that isn't large by commercial standards. It certainly doesn't run into
terabytes!

Under those situations, the Obvious Thing is to put a filesystem onto
those disks, and put a number of large database extents in it, one after
the other. Any brain-dead format, or even FAT, should be able to lay
those files out sequentially.

After that, the database will just read or write to locations within
those files. They won't get moved around on disk [2].

Under normal use, it really doesn't matter much anyway. The database
will have a massive cache containing the most recently used records, so
there won't be any predictability in the data access. Most records (and
the ones that you need for reporting purposes) tend to be entirely
ASCII: often quite a few will fit into an 8K block. People will want to
access that data all sorts of ways, so it's limited how much you can lay
those blocks out on disk to help access. Reports can easily want to
access hundreds of thousands of records, which may well be scattered all
over the database. That means you've effectively got the internal
database 100% fragmented anyway, and you're doing maybe a hundred
thousand random disk accesses at maybe one hundred per disk per second.

That's *why* you need all those disks.

When disk fragmentation does matter is the few times when you need to do
database maintenance, or to maintain the underlying hardware. Then
you'll need to copy data on and off the drive as fast as possible. Those
transfers are often sequential, and you don't want the files themselves
being fragmented. (It also helps if you're backing up to disk).

James.

[1] With separate RAID 1s for redo-undo purposes: these can be written
sequentially (= FAST) if you can dedicate disk heads just to writing
them.

[2] Barring bad-sector reassignment.

-- 
E-mail address: james | In the Royal Air Force a landing's OK,
@westexe.demon.co.uk  | If the pilot gets out and can still walk away.
                      | But in the Fleet Air Arm the outlook is grim,
                      | If your landings are duff and you've not learnt to
                      | swim.




More information about the ubuntu-users mailing list