All of lore.kernel.org
 help / color / mirror / Atom feed
* set sector or minimum write size?
@ 2011-08-28 19:43 Chris Pearson
  2011-08-29  0:17 ` Doug Dumitru
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Pearson @ 2011-08-28 19:43 UTC (permalink / raw)
  To: linux-raid

I have a 4k sector size drive claiming to be a 512 sector size drive.
 Is there a way to tell MD to never write less than 4k at a time?

From block dump:

md0_raid1(9007): WRITE block 8 on sdd1 (2 sectors)

happens frequently and probably requires a full revolution of the disk
unnecessarily.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: set sector or minimum write size?
  2011-08-28 19:43 set sector or minimum write size? Chris Pearson
@ 2011-08-29  0:17 ` Doug Dumitru
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Dumitru @ 2011-08-29  0:17 UTC (permalink / raw)
  To: Chris Pearson; +Cc: linux-raid

MD does not really work this way.The low level device will advertise a
hardware sector size.  In this case the drive claims it is 512 bytes.
This 512 byte sector size is maintained through the block IO stacks.
Thus MD, volume manager, fdisk, and pretty much everything else gets
512.

It is not possible for MD to enforce a large sector size.  This would
require a new device.  It is possible to create such a new device with
a kernel module, but it would not really do any good.  Plus a lot of
applications just plain break if they see anything other than 512.

In terms of performance, the drive will take a hit if you give it
non-4K writes.  This hit is pretty bad, if there are a lot of these.
Fortunately, most applications in Linux are perfectly happy to only
issue 4K aligned requests, if you take some precautions.

1)  Make sure than any partition on the device is 4K aligned.

1a)  The fdisk issue is also important if you are exporting a "block
device".  So if you are using OpenFiler or other SAN applications,
make sure that the client fdisk table is also on 4K centers.  This is
particularly important for volumes used by Windows XP.

2)  If you have the option to set 4K in a filesystem spec, do so.  I
know XFS is helped by this.  EXT2,3,4 file systems seem to default to
pretty pure 4K.  Look at the man page for other file systems to see if
there is a "blocksize" option.

Other things like LVM are already 4K (or much larger), so they don't
need anything.

Because Linux has a 4K page cache, most filesystem designs tend to
work on 4K (or multiples thereof) boundaries.  Also, this type of disk
is getting very common, especially for huge (multi-terrabyte) drives.
A lot of SSDs and SANs also work best with 4K.

If you do these things, you might still see an occasional short IO,
but they should be rare.

Doug Dumitru
EasyCo LLC

On Sun, Aug 28, 2011 at 12:43 PM, Chris Pearson <kermit4@gmail.com> wrote:
>
> I have a 4k sector size drive claiming to be a 512 sector size drive.
>  Is there a way to tell MD to never write less than 4k at a time?
>
> From block dump:
>
> md0_raid1(9007): WRITE block 8 on sdd1 (2 sectors)
>
> happens frequently and probably requires a full revolution of the disk
> unnecessarily.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Doug Dumitru
EasyCo LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-29  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-28 19:43 set sector or minimum write size? Chris Pearson
2011-08-29  0:17 ` Doug Dumitru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.