How to restart a ‘stopped’ bcache device

bcache

I need to upgrade some drive firmware and I'd like to shut down bcache for the duration.

The docs show how to stop a bcache device:

stop

Write to this file to shut down the bcache device and close the backing device.

For me that will look like this:

echo 1 > /sys/block/bcache0/bcache/stop

and for the cache device:

echo 1 > /sys/fs/bcache/<set-uuid>/stop

But how do I bring the device back (without rebooting the server)?

Best Answer

Simply re-register each bcache device in the cache set (both backing and cache devices) to the kernel:

echo /dev/<path_to_device> > /sys/fs/bcache/register

Or, if the udev rules from bcache-tools are in place, then partprobe will automatically register the devices when they are scanned.

Related Question