Disclaimer: the following seems (to me)like a logical way to defragment a partition. I just used these steps myself and nothing died. Please don't blame me if you kill something!
It's not exactly true that your linux filesystems don't get fragmented. If you are using ext2 or ext3 you can see an approximation of the fragmentation using e2fsck -f /dev/hdx. ONLY RUN THIS ON UNMOUNTED PARTITIONS!! This might mean you need to boot from a live CD.
You can 'defrag' any filesystem using this method (AFAIK), although if i remember correctly the resierfs tool to check the filesystem doesn't show and indicator of fragmentation. I have heard reiserfs fragments more easily than ext2 & 3 but i've never tested this.
Code:
linuxbox portage # umount /dev/vg/distfiles
linuxbox portage # e2fsck -f /dev/vg/distfiles
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
distfiles: 565/262144 files (12.9% non-contiguous), 348321/524288 blocks
This shows 12.9% fragmentation. However, there are only 565 files using 1.3GB so this is not a big deal. It's possible to defragment this partition by remounting it and creating a tar archive of all the files on it. You can then remove all the files on the partition, format it if you really want, and then uncompress the archive back in place.
Code:
linuxbox portage # mount /dev/vg/distfiles
linuxbox portage # cd distfiles/
linuxbox distfiles # tar cpf /tmp/distfiles.tar *
linuxbox distfiles # rm -r *
linuxbox distfiles # tar xpf /tmp/distfiles.tar
unmounting the partition again and running e2fsck -f /dev/vg/distfiles shows 5.0% non-contiguous.