All of lore.kernel.org
 help / color / mirror / Atom feed
* replacing cache device "live"
@ 2017-02-10 11:10 Jens-U. Mozdzen
  2017-02-10 19:32 ` Eric Wheeler
  0 siblings, 1 reply; 2+ messages in thread
From: Jens-U. Mozdzen @ 2017-02-10 11:10 UTC (permalink / raw)
  To: linux-bcache

Hi *,

I'd like to change the cache device setup of my servers, with a  
minimum of downtime (if at all).

https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt?h=bcache-dev describes the steps required to replace the caching  
device:

- detach the caching device (echo 1 > /sys/block/bcacheX/bcache/detach)

- unregister the cache set (echo 1 > /sys/fs/bcache/<uuid>/stop)

I believe that issuing that second step will break access to  
/dev/bcacheX, so cannot be done without interrupting the service  
(description for cset "stop" in bcache.txt: "Write to this file to  
shut down the cache set - waits until all attached backing devices  
have been shut down.").

What I'm actually looking for is to change the sectors per block value  
of the caching device, without having to shut down operations on the  
according bcache device (cache_mode=none at that time). Is there any  
way to do so?

Regards,
Jens

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

* Re: replacing cache device "live"
  2017-02-10 11:10 replacing cache device "live" Jens-U. Mozdzen
@ 2017-02-10 19:32 ` Eric Wheeler
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wheeler @ 2017-02-10 19:32 UTC (permalink / raw)
  To: Jens-U. Mozdzen; +Cc: linux-bcache

On Fri, 10 Feb 2017, Jens-U. Mozdzen wrote:

> Hi *,
> 
> I'd like to change the cache device setup of my servers, with a minimum of
> downtime (if at all).
> 
> https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt?h=bcache-dev
> describes the steps required to replace the caching device:
> 
> - detach the caching device (echo 1 > /sys/block/bcacheX/bcache/detach)
> 
> - unregister the cache set (echo 1 > /sys/fs/bcache/<uuid>/stop)
> 
> I believe that issuing that second step will break access to /dev/bcacheX, so
> cannot be done without interrupting the service (description for cset "stop"
> in bcache.txt: "Write to this file to shut down the cache set - waits until
> all attached backing devices have been shut down.").
> 
> What I'm actually looking for is to change the sectors per block value of the
> caching device, without having to shut down operations on the according bcache
> device (cache_mode=none at that time). Is there any way to do so?

Yes, detaching the cache device should be safe.  It will writeback the 
data (if writeback) and then detach.  Sometimes writeback takes a while.

Then you should be able to `make-bcache -C -w 4096 /dev/cachedev` with any 
other opts you like and attach it to the cache dev.  Here are my notes 
for hot-remove-replace of cachedevs.  My cache device is /dev/ssd/bcache_cache:

# To remove cache:
~] bcache-super-show /dev/ssd/bcache_cache
[...]
cset.uuid		3db83b23-1af7-43a6-965d-c277b402b16a

~] echo 3db83b23-1af7-43a6-965d-c277b402b16a > /sys/block/bcache0/bcache/detach
~] watch cat /sys/block/bcache0/bcache/dirty_data
  # wait until 0
~] echo 1 > /sys/fs/bcache/3db83b23-1af7-43a6-965d-c277b402b16a/unregister

# To add cache without recreating backing volume
~] make-bcache -w 4096 -C /dev/ssd/bcache_cache --writeback
[...]
Set UUID:		492d94e3-8298-4a5b-9ee1-c12cbda2c780

~] bcache-super-show /dev/ssd/bcache_cache
[...]
cset.uuid		492d94e3-8298-4a5b-9ee1-c12cbda2c780

~] echo /dev/ssd/bcache_cache > /sys/fs/bcache/register
~] echo 492d94e3-8298-4a5b-9ee1-c12cbda2c780 > /sys/block/bcache0/bcache/attach

--
Eric Wheeler


> 
> Regards,
> Jens
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" 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:[~2017-02-10 19:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 11:10 replacing cache device "live" Jens-U. Mozdzen
2017-02-10 19:32 ` Eric Wheeler

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.