Gentoo Archives: gentoo-user

From: Paul Hartman <paul.hartman+gentoo@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] aligning SSD partitions
Date: Wed, 05 Sep 2012 19:04:15
Message-Id: CAEH5T2O=4UMxviwT=8yckOyNzHWLsm1wBR+2C8Wbe8jju7E=jg@mail.gmail.com
In Reply to: Re: [gentoo-user] aligning SSD partitions by Dale
1 On Wed, Sep 5, 2012 at 1:02 PM, Dale <rdalek1967@×××××.com> wrote:
2 > Peter Humphrey wrote:
3 >> On Wednesday 05 September 2012 13:02:01 Dale wrote:
4 >>
5 >>> I find that after a big update, like KDE, it helps to defrag /usr.
6 >> Interesting. I've just run sudo e4defrag -c /usr and got a fragmentation
7 >> of zero. That's after upgrading KDE last week.
8 >>
9 >> Then I ran it on all the nine ext4 partitions here and only two had
10 >> nonzero fragmentations; one was 1 and the other 2.
11 >>
12 >> Looks like I can forget about it on this box.
13 >>
14 >
15 > I have to say that here, it is not a whole lot of fragmentation but it
16 > does seem a bit faster afterwards. I guess it depends on what is
17 > fragmented and such. I sometimes wonder if it defrags itself. Even
18 > when I watch the fsck when booting, all the ext4 partitions have a very
19 > small percentage of fragmentation. My /boot which is ext2 is fragmented
20 > as heck. lol I'm not worried about it tho. ;-) When I was using
21 > reiserfs, it was always a good bit of fragmentation.
22 >
23 > Just thought it was worth a mention since this is the first time I saw a
24 > Linux defrag tool.
25
26 I think almost all linux defrag tools/techniques deal with file
27 fragmentation only, that is to say one file with more than 1 extent,
28 but don't deal with filesystem fragmentation (10000 small files
29 scattered all over the drive, rather than written contiguously). So
30 I'm not surprised that Peter did not see fragmentation after
31 installing KDE.
32
33 AFAIK almost all that modern defrag tools do is just copy the file,
34 allocating the whole file at once in the copy process, and if that new
35 copy has fewer extents than the old copy, it fills in the data, then
36 removes the original file. The concept is not entirely dissimilar to
37 the old "backup, format, restore" defrag process.
38
39 Over the years I have used a poor-man's version of that concept to
40 defrag files. Just move it to another drive (or -- even better -- a
41 ramdrive/tmpfs), then move it back to disk (with a tool that performs
42 preallocation).
43
44 There is a userland defrag tool that does exactly this, on any
45 filesystem. It is called "shake".
46
47 Typically I only see fragmentation on large files that were copied
48 from a slow source (over the network/internet), or bittorrent clients
49 that do not preallocate space, etc. Any kind of streaming file that
50 was written, huge multi-gigabyte video recording files, that kind of
51 stuff. But the key to avoiding file fragmentation is preallocation...

Replies

Subject Author
Re: [gentoo-user] aligning SSD partitions Dale <rdalek1967@×××××.com>