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 21:25:34
Message-Id: CAEH5T2NbvngCQm+G0v8wS1qvgzm9zC5L8f6fOofxYuG0ZFuOaw@mail.gmail.com
In Reply to: Re: [gentoo-user] aligning SSD partitions by Dale
1 On Wed, Sep 5, 2012 at 3:46 PM, Dale <rdalek1967@×××××.com> wrote:
2 > Paul Hartman wrote:
3 >> On Wed, Sep 5, 2012 at 1:02 PM, Dale <rdalek1967@×××××.com> wrote:
4 >>>
5 >>> I have to say that here, it is not a whole lot of fragmentation but it
6 >>> does seem a bit faster afterwards. I guess it depends on what is
7 >>> fragmented and such. I sometimes wonder if it defrags itself. Even
8 >>> when I watch the fsck when booting, all the ext4 partitions have a very
9 >>> small percentage of fragmentation. My /boot which is ext2 is fragmented
10 >>> as heck. lol I'm not worried about it tho. ;-) When I was using
11 >>> reiserfs, it was always a good bit of fragmentation.
12 >>>
13 >>> Just thought it was worth a mention since this is the first time I saw a
14 >>> Linux defrag tool.
15 >> I think almost all linux defrag tools/techniques deal with file
16 >> fragmentation only, that is to say one file with more than 1 extent,
17 >> but don't deal with filesystem fragmentation (10000 small files
18 >> scattered all over the drive, rather than written contiguously). So
19 >> I'm not surprised that Peter did not see fragmentation after
20 >> installing KDE.
21 >>
22 >> AFAIK almost all that modern defrag tools do is just copy the file,
23 >> allocating the whole file at once in the copy process, and if that new
24 >> copy has fewer extents than the old copy, it fills in the data, then
25 >> removes the original file. The concept is not entirely dissimilar to
26 >> the old "backup, format, restore" defrag process.
27 >>
28 >> Over the years I have used a poor-man's version of that concept to
29 >> defrag files. Just move it to another drive (or -- even better -- a
30 >> ramdrive/tmpfs), then move it back to disk (with a tool that performs
31 >> preallocation).
32 >>
33 >> There is a userland defrag tool that does exactly this, on any
34 >> filesystem. It is called "shake".
35 >>
36 >> Typically I only see fragmentation on large files that were copied
37 >> from a slow source (over the network/internet), or bittorrent clients
38 >> that do not preallocate space, etc. Any kind of streaming file that
39 >> was written, huge multi-gigabyte video recording files, that kind of
40 >> stuff. But the key to avoiding file fragmentation is preallocation...
41 >>
42 >>
43 >
44 > I used shake before but it just didn't seem to work right for me. I
45 > found a script that does something and it seems to work for the most
46 > part but still not great or anything. I just like the way ext4 works.
47 > Heck, I liked it before I found the defrag tool. I've had this install
48 > for a while and it has never had much fragmentation even before the
49 > tool. So, I find it funny that they make a tool that really isn't
50 > needed very much. :/
51
52 I think shake's default options might require extended attributes
53 enabled in your mounted fs. It also has some thresholds for file size
54 and age that cause it to skip certain files, unless you tell it
55 otherwise. I haven't used it in quite a long time, to be honest. :)