Re: Trying to attach a cache drive gives "invalid argument"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Dec 2019, Mike wrote:

> 4096 should have worked regardless of the 512 sector size.
> I'm wondering if there was a partition alignment issue -- something relating to the first writable sector
> position on the drive. For example, when partitioning drives using GPT I have found it necessary to make the
> first writable sector 2048.
> 
> it's only a guess and I am writing on the fly and not in front of a computer to double-check myself. Your post
> caught my eye and thought it was worth a mention.

The bdev can be 4k with a 512b cache, but not the other way around: With a 
512b bdev and a 4k cache you may get 512b IOs to the cache which will (of 
course) fail.

Note that cache devices with 4k sectors are experimental.  There have been 
(rare) problems with that configuration but the problem hasn't been pinned 
down.  Report to the list if you get strange errors in dmesg about sector 
alignment if you have a cache w/ 4k sectors.

--
Eric Wheeler



> 
> On Wed, Dec 11, 2019, 4:48 PM Nathan Dehnel <ncdehnel@xxxxxxxxx> wrote:
>       I figured it out. The backing drives have a 512B sector size, and I
>       used 4k with the cache drive. I'm shocked they don't use 4k, they're
>       all relatively recent WD blacks. I thought they all transitioned years
>       and years ago.
>       Thanks anyways.
> 
>       On Tue, Dec 10, 2019 at 1:07 PM Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> wrote:
>       >
>       > On Mon, 9 Dec 2019, Nathan Dehnel wrote:
>       >
>       > > root@gentooserver /home/nathan # blockdev --report /dev/bcache0
>       > > RO    RA   SSZ   BSZ   StartSec            Size   Device
>       > > rw   256   512  4096          0   1000203083776   /dev/bcache0
>       > > root@gentooserver /home/nathan # blockdev --report /dev/md0
>       > > RO    RA   SSZ   BSZ   StartSec            Size   Device
>       > > rw   256   512  4096          0     14255390720   /dev/md0
>       > > root@gentooserver /home/nathan # blockdev --report /dev/sda1
>       > > RO    RA   SSZ   BSZ   StartSec            Size   Device
>       > > rw   256   512  4096       2048   1000203091968   /dev/sda1
>       > > root@gentooserver /home/nathan # bcache-super-show /dev/md0
>       > > sb.magic                ok
>       > > sb.first_sector         8 [match]
>       > > sb.csum                 E9D560726742DDAB [match]
>       > > sb.version              3 [cache device]
>       > >
>       > > dev.label               (empty)
>       > > dev.uuid                cf8bc992-9797-4f47-8d3c-78731f5d1c2e
>       > > dev.sectors_per_block   8   <<<
>       >   ^^^^^^^^^^^^^^^^^^^^^^^^^
>       >
>       > > dev.sectors_per_bucket  1024
>       > > dev.cache.first_sector  1024
>       > > dev.cache.cache_sectors 27841536
>       > > dev.cache.total_sectors 27842560
>       > > dev.cache.ordered       yes
>       > > dev.cache.discard       no
>       > > dev.cache.pos           0
>       > > dev.cache.replacement   0 [lru]
>       > >
>       > > cset.uuid               45511b33-6bb8-42d5-a255-3de1749f8dda
>       > > root@gentooserver /home/nathan # bcache-super-show /dev/sda1
>       > > sb.magic                ok
>       > > sb.first_sector         8 [match]
>       > > sb.csum                 7D8A76D84F264724 [match]
>       > > sb.version              1 [backing device]
>       > >
>       > > dev.label               (empty)
>       > > dev.uuid                d4d2b9d6-077d-4328-b2cd-14f6db259955
>       > > dev.sectors_per_block   1   <<<
>       >   ^^^^^^^^^^^^^^^^^^^^^^^^^
>       >
>       > I think this is the issue.
>       >
>       > Assuming your cache doesn't have data on it yet, try this:
>       >         make-bcache --block 4k -B /dev/sdX1
>       >
>       > --
>       > Eric Wheeler
>       >
>       >
>       >
>       > > dev.sectors_per_bucket  1024
>       > > dev.data.first_sector   16
>       > > dev.data.cache_mode     0 [writethrough]
>       > > dev.data.cache_state    0 [detached]
>       > >
>       > > cset.uuid               4ae1adfc-b345-419f-9ce0-b450854370b0
>       > >
>       > > On Mon, Dec 9, 2019 at 7:15 PM Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> wrote:
>       > > >
>       > > > On Mon, 9 Dec 2019, Nathan Dehnel wrote:
>       > > >
>       > > > > [ 9651.101227] bcache: bch_cached_dev_attach() Couldn't attach sda1:
>       > > > > block size less than set's block size
>       > > >
>       > > > What do these report:
>       > > >
>       > > > blockdev --report /dev/bcache0
>       > > > blockdev --report /dev/sdX     # bcache cache dev
>       > > > blockdev --report /dev/sdY     # bcache bdev
>       > > >
>       > > >
>       > > > bcache-super-show /dev/sdX # bcache cache dev
>       > > > bcache-super-show /dev/sdY # bcache bdev
>       > > >
>       > > > --
>       > > > Eric Wheeler
>       > > >
>       > > > >
>       > > > > On Mon, Dec 9, 2019 at 6:30 PM Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> wrote:
>       > > > > >
>       > > > > > On Mon, 9 Dec 2019, Nathan Dehnel wrote:
>       > > > > >
>       > > > > > > root@gentooserver / # echo 45511b33-6bb8-42d5-a255-3de1749f8dda >
>       > > > > > > /sys/block/bcache0/bcache/attach
>       > > > > > > -bash: echo: write error: Invalid argument
>       > > > > >
>       > > > > > What does `dmesg` say?
>       > > > > >
>       > > > > >
>       > > > > > --
>       > > > > > Eric Wheeler
>       > > > > >
>       > > > > >
>       > > > > >
>       > > > > > >
>       > > > > > > How should I fix this?
>       > > > > > >
>       > > > >
>       > >
> 
> 
> 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux