1

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
        --cache_replacement_policy=(lru|fifo)
    -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?

1 Answer 1

1

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

and

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .