Can I change my Bcache settings on the fly?

Ask Ubuntu Asked on December 29, 2021

I made a fresh install of ubuntu 20.04 on my desktop, and then, from within the installation, created a bcache device to put my /home

sudo make-bcache -C /dev/sdb4 -B /dev/sda1

Where /dev/sdb is the ssd and /dev/sda is the hdd.
But after doing so, editing fstab, and transferring the data into the partition, I realized that I never set it to –writeback mode or specified the cache replacement policy

make-bcache --help
Usage: make-bcache [options] device
    -C, --cache     Format a cache device
    -B, --bdev      Format a backing device
    -b, --bucket        bucket size
    -w, --block     block size (hard sector size of SSD, often 2k)
    -o, --data-offset   data offset in sectors
        --cset-uuid     UUID for the cache set
        --writeback     enable writeback
        --discard       enable discards
    -h, --help      display this help and exit

Is it possible to change the configuration of my existing bcache to do that without losing data or would I be better starting over?

One Answer

You can change both replacement policy and cache mode via the /sys interfaces while the system is running. Just echo the appropriate setting word to the file and it changes the setting.

The control file contents show the available options and current setting when you read them - for example:

# cat /sys/fs/bcache/[you cache id]/cache0/cache_replacement_policy
[lru] fifo random


# cat /sys/block/[your bcache device]/bcache/cache_mode
writethrough writeback [writearound] none

Answered by Rob AKA on December 29, 2021

Add your own answers!

Related Questions

Poor/slow video on Zoom

1  Asked on December 1, 2020 by sjoseph


Ubuntu 20.04 sound bug

0  Asked on December 1, 2020 by fersu


How can I install gem5?

4  Asked on December 1, 2020 by deepsidhu1313


Ubuntu 20.04 LTS 64-bit installation freezes

0  Asked on November 30, 2020 by dbc_xl


Install Ubuntu Patch to solve CVE

1  Asked on November 30, 2020 by kostas-t


How to install a Canon PIXMA IP 3300?

1  Asked on November 29, 2020 by niols


In what file does gnome-calendar store calendar events?

1  Asked on November 28, 2020 by astral-axiom


error installing on via motherboard C3 CPU

1  Asked on November 28, 2020 by johan-designervisuals


Intel(R) UHD Graphics and VLC video lagging 18.04 XPS 13

0  Asked on November 28, 2020 by junaid-farooq


CUDA install removes Nvidia driver in ubuntu 18.04

0  Asked on November 28, 2020 by pranto


Display Image, cannot reach X server

1  Asked on November 28, 2020 by guillaume


Main sound device disappears after resuming from sleep mode

1  Asked on November 28, 2020 by franois-requet


how to resolve -bash: /etc/ViewPowerPro/Console: No such file or directory at startup?

1  Asked on November 27, 2020 by carlos-andres-zapata-cuervo


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir