On Wed, Feb 22, 2012 at 12:07:11PM +0100, Otto Moerbeek wrote:

> On Wed, Feb 22, 2012 at 11:25:44AM +0200, Alexey Vatchenko wrote:
> 
> > On Tue, Feb 21, 2012 at 01:25:40PM -0500, Kenneth R Westerback wrote:
> > > On Tue, Feb 21, 2012 at 12:55:36PM -0500, Ted Unangst wrote:
> > > > On Tue, Feb 21, 2012, Kenneth R Westerback wrote:
> > > > > On Tue, Feb 21, 2012 at 03:15:29PM +0200, Alexey Vatchenko wrote:
> > > > >> Reading 512 bytes from raw device with 2048 sector size fails. If i 
> > > > >> read
> > > > >> 512 bytes from block device the problem is not reproduced.
> > > > 
> > > > > This is intentional. You cannot read from a raw device fewer bytes
> > > > > at a time than the minimum the device provides per i/o. On block
> > > > > devices the buffer cache does the correct size i/o and extracts
> > > > > just the number of bytes you requested.
> > > > 
> > > > That's backwards from what I thought.  The raw device should let you
> > > > read byte by byte, the block device only lets you read block by block,
> > > > as it were.
> > > 
> > > Block/Sector based devices can only provide entire blocks/sectors,
> > > at block/sector addresses. The buffer cache and standard i/o routines
> > > provide the abstraction that you can start and stop at any byte.
> > > 
> > > Doing I/O to raw devices means you are taking full responsibility for
> > > paying attention to the boundaries and sizes of the i/o.
> > 
> > I thought that it was bug because it's a character device.
> > 
> > Anyway, the problem is fsck that execv fsck_msdos with raw device.
> > Maybe better to keep device name from the calling process (fsck)?
> 
> No that is not correct. fsck should not work via the buffer cache.
> 
>       -Otto

Why should find out why fsck thinks this is a 512 device. Please post
your dmesg and disklabel.

        -Otto

Reply via email to