docs/128804: Gmirror handbook instructions convert boot-drive to gmirror, truncating last sector

Bob Johnson fbsdlists at gmail.com
Wed Nov 19 18:32:07 UTC 2008


On 11/12/08, Tom Rhodes <trhodes at freebsd.org> wrote:
> On Wed, 12 Nov 2008 20:04:54 -0500
> Tom Rhodes <trhodes at FreeBSD.org> wrote:
>
>> On Wed, 12 Nov 2008 09:54:49 -0500
>> "Bob Johnson" <fbsdlists at gmail.com> wrote:
>>
>> > The user has no control over whether the last sector of the drive is
>> > used for data. Data is scattered all over the drive, in something that
>> > resembles a random fashion, and I know of no reason the last sector is
>> > not just as likely to have data stored to it as any other sector on
>> > the drive (but I am certainly not an authority on the filesystem
>> > algorithms).
>> >
>> > I think a warning is very much in order (that there is a small chance
>> > that data will be lost by this procedure).
>> >
>> > - Bob
>>

Well, I got distracted and never replied to this, but since the PR is
still open, here's more:

>>
>> Don't Unix file systems attempt to lump data closer together
>> in order to reduce this fragmentation which scatters data
>> across the entire drive, making it unlikely to have data in
>> that last sector unless one went beyond the 8% boundry?


In general, no, it is pretty much the opposite. It would be more
accurate to view it as intentionally fragmenting the drive in a
controlled way so that the problems caused by fragmentation are
minimized. The heuristic used probably tends to favor leaving the last
sector of the filesystem empty longer than most other sectors, but it
can still be used long before the entire filesystem is full (assuming
there isn't some other consideration I don't know about -- I'm no
expert on the details of the algorithms used).

This is because, in general, the goal of the filesystem layout scheme
is to avoid completely filling any physical region (cylinder group) if
it can be avoided, so it spreads data out among the cylinder groups.
This strategy helps keep large chunks of empty space available, so
that new data has a good chance of being stored on contiguous sectors.
The blocks that belong to one file will tend to be physically close to
each other so that the file can be read quickly, but the files
themselves end up scattered all over the disk. There are a few ways in
which a file can end up being stored on a specific cylinder group, but
the result is that the group at the physical end of the filesystem is
likely to be used long before the entire filesystem is full. If it
happens that the files stored on the last cylinder group are large, or
there are many of them, it is possible to write the last sector long
before the entire filesystem is full. There is some degree of random
chance in the process.

-- Bob Johnson
   fbsdlists at gmail.com



More information about the freebsd-doc mailing list