Git Product home page Git Product logo

bcache-tools's People

Contributors

akiradeveloper avatar g2p avatar koverstreet avatar lge avatar onlyjob avatar rolffokkens avatar run2000 avatar rutsky avatar vodik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcache-tools's Issues

How can I bind bcache<N>?

Hello everyone,
When I restarted the machine, bcache floated to other devices.
How can I bind bcache?

before reboot
root@ubuntu18:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  100G  0 disk
└─sda1        8:1    0  100G  0 part /
sdb           8:16   0   20G  0 disk
├─sdb1        8:17   0    5G  0 part
├─sdb2        8:18   0    5G  0 part
└─sdb3        8:19   0    9G  0 part
  ├─bcache0 252:0    0   20G  0 disk
  └─bcache1 252:128  0   20G  0 disk
sdc           8:32   0   20G  0 disk
sdd           8:48   0   20G  0 disk
└─bcache1   252:128  0   20G  0 disk
sde           8:64   0   20G  0 disk
└─bcache0   252:0    0   20G  0 disk
sr0          11:0    1  900M  0 rom  

after reboot
root@ubuntu18:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  100G  0 disk
└─sda1        8:1    0  100G  0 part /
sdb           8:16   0   20G  0 disk
├─sdb1        8:17   0    5G  0 part
├─sdb2        8:18   0    5G  0 part
└─sdb3        8:19   0    9G  0 part
  ├─bcache0 252:0    0   20G  0 disk
  └─bcache1 252:128  0   20G  0 disk
sdc           8:32   0   20G  0 disk
sdd           8:48   0   20G  0 disk
└─bcache0   252:0    0   20G  0 disk
sde           8:64   0   20G  0 disk
└─bcache1   252:128  0   20G  0 disk
sr0          11:0    1  900M  0 rom  

Unable to build with latest GCC

The latest GCC throws errors about inline crc64. Completely not a C programmer, but the fix on the debian mailing lists appears to be below:

--- a/bcache.c
+++ b/bcache.c
@@ -115,7 +115,7 @@ static const uint64_t crc_table[256] = {
0x9AFCE626CE85B507ULL
};

-inline uint64_t crc64(const void *_data, size_t len)
+uint64_t crc64(const void *_data, size_t len)
{
uint64_t crc = 0xFFFFFFFFFFFFFFFFULL;
const unsigned char *data = _data;

Possible temporary udev race condition breaks bcache-register

From: http://thread.gmane.org/gmane.linux.kernel.bcache.devel/2594

If I understand udev correctly, this sort of "conflict" is an inevitable consequence of its asynchronous nature, and helper programs like bcache-register need to be robust enough to deal with them.

(If I'm wrong about this, then I guess this is a udev bug?)

BTW, this is what the bcache-related dmesg entries look like when I hit the conflict with my patches applied:

[ 1.761932] bcache: bch_journal_replay() journal replay done, 1972 keys in 75 entries, seq 312536
[ 1.762043] bcache: register_cache() registered cache device sda2
[ 1.762631] bcache: register_bcache() error opening /dev/md126p5: device busy
[ 1.862949] bcache: register_bdev() registered backing device md126p5
[ 1.864268] bcache: bch_cached_dev_attach() Caching md126p5 as bcache0 on set fb8d253b-6144-4b48-8ed6-7b1724ed83a7
[ 3.553053] bcache: register_bcache() error opening /dev/sda2: device already registered
[ 4.182180] bcache: register_bcache() error opening /dev/md126p5: device already registered

You can see that the backing device is busy when it first tries to
register it, but it succeeds 1/10th of a second later. (I'm assuming
the last two "already registered" messages occur when udev replays
its events later in the boot process.)

mount bcache device from live usb

Hello.
Is there any way to mount bcache device from live usb. I use ubuntu as live env and installed bvache-tools. lsblk gives me

sdd                   8:48   0 931.5G  0 disk 
├─sdd1                8:49   0  1007K  0 part 
└─sdd2                8:50   0 931.5G  0 part 
  ├─vg0-home (dm-0) 252:0    0   100G  0 lvm  
  ├─vg0-var (dm-1)  252:1    0    20G  0 lvm  
  ├─vg0-boot (dm-2) 252:2    0   256M  0 lvm  
  └─vg0-root (dm-3) 252:3    0  29.8G  0 lvm 

But when I try to mount f.e. root, I get:

sudo mount /dev/vg0/root /mnt/
mount: you must specify the filesystem type

Thanks.

Improving the performance of my secondary HDD

Hi,

Recently I purchased an SSD and started using bcache to speed up my
secondary HDD. My entire linux installation and home directory is
setup on the SSD and I have set aside a 20GB partition for bcache.

My secondary storage has multiple partitions all of which are setup as
backing devices and are used to store various types of file,
virtualbox disk images, etc. which are seldom accessed.

I would like to know if bcache would really be effective in my setup,
say for example to speed up the virtual machines since the HDD
partitions are being cached using bcache? Considering that my virtual
machine image sizes would be between 8 - 16 GB, would I need to
perform some level of tuning to achieve a noticeable performance
improvement.

Lastly, should I be noticing a marked improvement in the HDD write
operations or would I need to turn on "write back" mode?

Please do share your inputs.

Thanks and Regards

build error: undefined reference to `crc64'

build bcache-tools faild at version: 1.0.8

log:

/tmp/root/spack-stage/spack-stage-bcache-1.0.8-tnsdfcsyjb6kbe5yraubcegcuk237xuy/spack-src/bcache-super-show.c:117: undefined reference to `crc64'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: bcache-super-show] Error 1
make: *** Waiting for unfinished jobs....
/usr/local/bin/ld: /tmp/ccSk24CW.o: in function `write_sb':
/tmp/root/spack-stage/spack-stage-bcache-1.0.8-tnsdfcsyjb6kbe5yraubcegcuk237xuy/spack-src/make-bcache.c:277: undefined reference to `crc64'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: make-bcache] Error 1

I think we should remove inline to make it linked with other obj?
or move crc64 inline code to bcache.h?

# grep -nr "crc64"
bcache.c:118:inline uint64_t crc64(const void *_data, size_t len)
bcache.h:118:uint64_t crc64(const void *_data, size_t len);
bcache.h:124:   crc64(((void *) (i)) + 8, ((void *) end(i)) - (((void *) (i)) + 8))

task bcache_writebac:286 blocked for more than 120 seconds

Hi,
I have recently installed bcache and this error maintains the load at 100%. My computer (Elite Book 8570W) displays a 200% all the time even when X server is off.
I am running a Debian jessie
Linux xxxxxxxxx 3.13-1-amd64 #1 SMP Debian 3.13.10-1 (2014-04-15) x86_64 GNU/Linux
When I stop writeback with this command:
echo 0 > /sys/block/bcache0/bcache/writeback_running
average load drops from 2.00+ to 1.00+ but not to 0.00+
I have installed bcache with a backup on a dedicated partition sda6 on my HDD
installation went well and things seem correct (I have repaced the bash $ by €):
root[14:47:13] xxxxxx € : ./probe-bcache /dev/sdb1
3166e109-d2c7-4436-a1f4-08f75ec4a7c8: UUID="" TYPE="bcache"
root[14:49:03] xxxxxxx.€ : ./probe-bcache /dev/sda6
0fbf28e0-7a5d-4565-bd45-03a38ec88680: UUID="" TYPE="bcache"
root[14:49:09] xxxxxxxx.€ : ls /sys/fs/bcache/
c3a8848e-d074-4b9d-90e5-c973bd465375/ register register_quiet

dmesg gives this trace:
[ 1084.807350] INFO: task bcache_writebac:286 blocked for more than 120 seconds.
[ 1084.807356] Tainted: P O 3.13-1-amd64 #1
[ 1084.807357] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1084.807358] bcache_writebac D ffff880429f26350 0 286 2 0x00000000
[ 1084.807363] ffff880429f26010 0000000000000046 0000000000014280 0000000000014280
[ 1084.807365] ffff88042937ffd8 ffff880429f26010 ffff880429e7b8c0 ffff8804287b0000
[ 1084.807367] ffffffffa0205790 0000000000000000 0000000000000000 0000000000000000
[ 1084.807370] Call Trace:
[ 1084.807400] [] ? write_dirty_finish+0x210/0x210 [bcache]
[ 1084.807404] [] ? kthread+0x9d/0xe0
[ 1084.807407] [] ? kthread_create_on_node+0x180/0x180
[ 1084.807411] [] ? ret_from_fork+0x7c/0xb0
[ 1084.807413] [] ? kthread_create_on_node+0x180/0x180
[ 1104.219084] systemd-logind[4917]: Removed session c35.
[ 1104.219381] systemd-logind[4917]: New session c36 of user vidal.
[ 1204.957158] INFO: task bcache_writebac:286 blocked for more than 120 seconds.
[ 1204.957163] Tainted: P O 3.13-1-amd64 #1
[ 1204.957165] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1204.957166] bcache_writebac D ffff880429f26350 0 286 2 0x00000000
[ 1204.957170] ffff880429f26010 0000000000000046 0000000000014280 0000000000014280
[ 1204.957172] ffff88042937ffd8 ffff880429f26010 ffff880429e7b8c0 ffff8804287b0000
[ 1204.957174] ffffffffa0205790 0000000000000000 0000000000000000 0000000000000000
[ 1204.957176] Call Trace:
[ 1204.957203] [] ? write_dirty_finish+0x210/0x210 [bcache]
[ 1204.957207] [] ? kthread+0x9d/0xe0
[ 1204.957209] [] ? kthread_create_on_node+0x180/0x180
[ 1204.957213] [] ? ret_from_fork+0x7c/0xb0
[ 1204.957215] [] ? kthread_create_on_node+0x180/0x180

I have found various posts describing the problem but no clear solution.

Could you please help.
It would also be usefull to have in the readme an "official" procedure to stop bcache and be sure to get rid of all scoria.

many thanks

bcache partition not registered in initramfs (with raid probes from udev)

Hi,

I installed your bcache-tools package from your ppa to use bcache for the root partition of my Ubuntu 13.10 install.
I have a bcache backing partition on my HDD at /dev/sda1, and a bcache caching partition on my SSD at /dev/sdb1.
On the top of /dev/bcache0, I have a btrfs filesystem, which is the root filesystem of my Ubuntu install.

The problem is: when I try to start Ubuntu, the boot procedure stops showing me the initramfs busybox shell, because it can't find the root btrfs filesystem which is inside bcache.
By looking at the busybox shell, I have seen that the bcache partition on my SSD is registered, but the one on my HDD not, so the /dev/bcache0 device is not created.
So I tried to launch in the initramfs shell: "echo /dev/sda1 > /sys/fs/bcache/register" and "exit", and then the system continued to boot perfectly.

As a workaround I added the line "echo /dev/sda1 > /sys/fs/bcache/register" at the end of /lib/udev/bcache-register. Now it works for me, but of course this is not a real solution :)

Allow separation of sequential_cutoff

This is a feature request for a very specific use case:

  • having a caching device in front of an md-raid on a machine which serves as a low power media server
  • the last writes should be cached on the caching device to reduce the non-sleep time of the raid, together with a huge writeback delay of, let's say, 3 hours
  • newest media will always be read from the caching device

I could disable sequential_cutoff or set it rediculously high. That would result in every read being cached into the caching device, too, which in this use case is not wanted.

Could you split up the sequential_cutoff setting to sequential_read_cutoff and sequential_write_cutoff?

Thank you in advance

build fail with gcc 7.3.1 on fedora 27 kernel 4.17.12

[root@neonjoe2 ~]# git clone https://evilpiepirate.org/git/bcache-tools.git
Cloning into 'bcache-tools'...
remote: Counting objects: 1840, done.
remote: Compressing objects: 100% (1119/1119), done.
remote: Total 1840 (delta 1090), reused 1240 (delta 688)
Receiving objects: 100% (1840/1840), 1.39 MiB | 4.56 MiB/s, done.
Resolving deltas: 100% (1090/1090), done.

[root@neonjoe2 ~]# cd bcache-tools/

[root@neonjoe2 bcache-tools]# make
cc -O2 -Wall -g pkg-config --cflags uuid blkid -c -o bcache.o bcache.c
bcache.c:125:9: warning: ‘crc_table’ is static but used in inline function ‘crc64’ which is not static
crc = crc_table[i] ^ (crc << 8);
^~~~~~~~~
cc -O2 -Wall -g pkg-config --cflags uuid blkid make-bcache.c bcache.o pkg-config --libs uuid blkid -o make-bcache
/tmp/cc8aGXdX.o: In function write_sb': /root/bcache-tools/make-bcache.c:277: undefined reference to crc64'
collect2: error: ld returned 1 exit status
make: *** [: make-bcache] Error 1
[root@neonjoe2 bcache-tools]# gcc --verion
gcc: error: unrecognized command line option ‘--verion’; did you mean ‘--version’?
gcc: fatal error: no input files
compilation terminated.

[root@neonjoe2 bcache-tools]# gcc --version
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@neonjoe2 bcache-tools]# uname -a
Linux neonjoe2 4.17.12-100.fc27.x86_64 #1 SMP Fri Aug 3 15:00:33 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@neonjoe2 bcache-tools]# cat /etc/os-release
NAME=Fedora
VERSION="27 (Server Edition)"
ID=fedora
VERSION_ID=27
PRETTY_NAME="Fedora 27 (Server Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:27"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=27
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=27
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Server Edition"
VARIANT_ID=server

set label for cached devices in make-bcache

hi,
it'd be convenient if make-bcache would let you set the label when formatting cached devices, this way the user doesn't have to search for the right bcache device and set the label afterwards.

thanks,
filippo

69-bcache.rules Tries to Re-register bcache that is already registered and attached

I have been using bcache for two drives (/dev/sda and /dev/sdb). The cache is registered correctly, but it looks like the UDEV rules in 69-bcache.rules need to be tweaked to identify if a bcache is already mounted when jumping to bcache_backing_found (line 22 is where the bcache-register command is run).

/var/log/messages

Sep 15 10:29:15 HTPC-Xeon systemd-udevd[3213322]: sda: Process 'bcache-register /dev/sda' failed with exit code 1.
Sep 15 10:29:15 HTPC-Xeon kernel: [132665.473836] bcache: register_bcache() error : device already registered
Sep 15 10:29:17 HTPC-Xeon systemd-udevd[3213322]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:17 HTPC-Xeon kernel: [132668.109215] bcache: register_bcache() error : device already registered
Sep 15 10:29:18 HTPC-Xeon systemd-udevd[3213433]: sda: Process 'bcache-register /dev/sda' failed with exit code 1.
Sep 15 10:29:18 HTPC-Xeon kernel: [132668.472411] bcache: register_bcache() error : device already registered
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213433]: message repeated 46 times: [ sda: Process 'bcache-register /dev/sda' failed with exit code 1.]
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213481]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:19 HTPC-Xeon kernel: [132669.919959] bcache: register_bcache() error : device already registered
Sep 15 10:29:19 HTPC-Xeon systemd-udevd[3213433]: sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.
Sep 15 10:29:19 HTPC-Xeon kernel: [132669.970662] bcache: register_bcache() error : device already registered
Sep 15 10:29:20 HTPC-Xeon systemd-udevd[3213433]: message repeated 45 times: [ sdb: Process 'bcache-register /dev/sdb' failed with exit code 1.]
root@HTPC-Xeon:/# bcache-super-show /dev/sda
sb.magic ok
sb.first_sector 8 [match]
sb.csum 6AEA0E3D0A952CEF [match]
sb.version 4 [backing device]
dev.label NAS
dev.uuid 6b52e51f-6c9f-4b7e-a245-9d2b63fc4bc5
dev.sectors_per_block 1
dev.sectors_per_bucket 1024
dev.data.first_sector 645120
dev.data.cache_mode 1 [writeback]
dev.data.cache_state 1 [clean]
cset.uuid e960d897-9990-47ab-90f9-69163b7d45b0
root@HTPC-Xeon:/# bcache-super-show /dev/sdb
sb.magic ok
sb.first_sector 8 [match]
sb.csum D19F0AAACEBB036B [match]
sb.version 4 [backing device]
dev.label BACKUP
dev.uuid 6c18a7f6-73ba-46a1-973f-9f296a42175b
dev.sectors_per_block 1
dev.sectors_per_bucket 1024
dev.data.first_sector 645120
dev.data.cache_mode 1 [writeback]
dev.data.cache_state 2 [dirty]
cset.uuid e960d897-9990-47ab-90f9-69163b7d45b0
root@HTPC-Xeon:/# bcache-status
--- bcache ---
Device /dev/sda (8:0)
UUID e960d897-9990-47ab-90f9-69163b7d45b0
Block Size 0.50KiB
Bucket Size 512.00KiB
Congested? False
Read Congestion 2.0ms
Write Congestion 20.0ms
Total Cache Size 1.09TiB
Total Cache Used 1.09TiB (100%)
Total Cache Unused 0B (0%)
Dirty Data 0.50KiB (0%)
Evictable Cache 905.42GiB (81%)
Replacement Policy [lru] fifo random
Cache Mode writethrough [writeback] writearound none
Total Hits 1916371 (63%)
Total Misses 1117878
Total Bypass Hits 791703 (24%)
Total Bypass Misses 2470122
Total Bypassed 103.00GiB
root@HTPC-Xeon:/# apt-cache policy bcache-tools
bcache-tools:
  Installed: 1.0.8-4ubuntu3
  Candidate: 1.0.8-4ubuntu3
  Version table:
 *** 1.0.8-4ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status
root@HTPC-Xeon:/# lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04

blocking when bcache-register

When use the cmd ./bcache-register /dev/sdc or echo /dev/sdc > /sys/fs/bcache/register, the cmd will be blocked, and not return. Event if I use Ctrl-C. Like this:

# ./bcache-register /dev/sdc
^C^C^C^C^C^C^C

Who can help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.