By inspiration from this thread. I threw together this little defragmentation scheme:
(For this to work make sure that the destination dir resides on the same file system as the copied files)
Code:
mkdir /refrag && cd /refrag
Backup (if you don't know how to rescue a dead system using only a LiveCD and this tar-file, stop reading now)
Code:
tar -c -T /etc/readahead/boot -f backup.tar
Create a numbered list of files. (Maybe paranoid step, but at least we won't have any surprises)
Code:
cat -n /etc/readahead/boot > files.txt
Copy those files to single dir (should pack them together on the disk)
Code:
cat files.txt | while read num file; do cp -dp "$file" "./$num"; done
Relink the files to the copies
Code:
cat files.txt | while read num file; do test -e "./$num" && ln -f "./$num" "$file"; done
I haven't done any measuring. Maybe someone here might be interested enough to do that though.
Bookmarks