diff options
7 files changed, 82 insertions, 73 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..ea21297
--- /dev/null
@@ -0,0 +1,14 @@
+ * libblkid
+ * libuuid
+ * libnih
+ * libscrypt
+ * libsodium
+ * libkeyutils
+On debian, you can install these with
+ apt install -y libblkid-dev uuid-dev libnih-dev libscrypt-dev libsodium-dev libkeyutils-dev
+Then, just make && make install
diff --git a/Makefile b/Makefile
index facdf68..9f2773e 100644
--- a/Makefile
+++ b/Makefile
@@ -8,21 +8,15 @@ PKGCONFIG_LIBS="blkid uuid libnih"
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
LDLIBS+=`pkg-config --libs ${PKGCONFIG_LIBS}` -lscrypt -lsodium -lkeyutils
-ifeq ($(PREFIX), "/usr")
+ifeq ($(PREFIX),/usr)
+.PHONY: all
all: bcache
-install: bcache
- $(INSTALL) -m0755 bcache $(DESTDIR)$(ROOT_SBINDIR)
- $(INSTALL) -m0644 -- bcache.8 $(DESTDIR)$(PREFIX)/share/man/man8/
- $(RM) bcache *.o *.a
CCANSRCS=$(wildcard ccan/*/*.c)
CCANOBJS=$(patsubst %.c,%.o,$(CCANSRCS))
@@ -34,5 +28,18 @@ bcache-objs = bcache.o bcache-assemble.o bcache-device.o bcache-format.o\
bcache: $(bcache-objs) libccan.a
+.PHONY: install
+install: bcache
+ mkdir -p $(DESTDIR)$(ROOT_SBINDIR)
+ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
+ $(INSTALL) -m0755 bcache $(DESTDIR)$(ROOT_SBINDIR)
+ $(INSTALL) -m0755 mkfs.bcache $(DESTDIR)$(ROOT_SBINDIR)
+ $(INSTALL) -m0644 bcache.8 $(DESTDIR)$(PREFIX)/share/man/man8/
+.PHONY: clean
+ $(RM) bcache *.o *.a
+.PHONY: deb
+deb: all
debuild -nc -us -uc -i -I
diff --git a/README b/README
index 4a13db6..56a26b0 100644
--- a/README
+++ b/README
@@ -1,27 +1,12 @@
-These are the userspace tools required for bcache.
+Userspace tools for bcache-dev/bcachefs
-Bcache is a patch for the Linux kernel to use SSDs to cache other block
-devices. For more information, see
-Documentation for the run time interface is included in the kernel tree, in
+This builds the bcache tool, which has a number of subcommands for formatting
+and managing bcachefs filesystems:
-Included tools:
+bcache format
+bcache unlock
+bcache assemble
+bcache incremental
-Formats a block device for use with bcache. A device can be formatted for use
-as a cache or as a backing device (requires yet to be implemented kernel
-support). The most important option is for specifying the bucket size.
-Allocation is done in terms of buckets, and cache hits are counted per bucket;
-thus a smaller bucket size will give better cache utilization, but poorer write
-performance. The bucket size is intended to be equal to the size of your SSD's
-erase blocks, which seems to be 128k-512k for most SSDs; feel free to
-Only necessary until support for the bcache superblock is included
-in blkid; in the meantime, provides just enough functionality for a udev script
-to create the /dev/disk/by-uuid symlink. The arguments it does support are the
-same as for blkid.
-Prints the bcache superblock of a cache device or a backing device.
+Run bcache --help for full list of commands.
diff --git a/bcache.8 b/bcache.8
index 52c5fe7..7671cf3 100644
--- a/bcache.8
+++ b/bcache.8
@@ -1,9 +1,9 @@
-.TH bcacheadm 8
+.TH bcache 8
-bcacheadm \- manage bcache devices
+bcache \- manage bcache filesystems/devices
-.B bcacheadm
+.B bcache
@@ -51,61 +51,63 @@ to create the /dev/disk/by-uuid symlink.
.BR help
-List the bcacheadm commands
+List the bcache commands
-.SH Options for bcacheadm
+.SH Options for bcache
.BR \--help
.SH Options for format
+.SH Global options:
-.BR \-C
-Create a cache
+.BR \-w,\ --block=
+block size, in bytes (e.g. 4k)
-.BR \-B
-Create a backing device
+.BR \-w,\ --btree_node_size=
+btree node size in bytes - default 256k
-.BR \-b\ --bucket-size=
-Specifies the bucket size.
+.BR \--metadata_checksum_type=TYPE
-.BR \-l\ --label=
+.BR \--data_checksum_type=TYPE
+where TYPE is one of none, crc32c (default), or crc64
-.BR \-w,\ --block=
-block size (hard sector size of SSD, often 2k
+.BR \--compression_type=TYPE
+where TYPE is one of none (default), lz4 or gzip
-.BR \-t,\ --tier=
-tier of subsequent devices
+.BR \--encrypted
+Enable encryption; passphrase will be prompted for
-.BR \--cache-replacement-policy=
-one of lru, fifo, or random
+.BR \--error_action=TYPE
+where TYPE is one of continue, readonly (default) or panic
-.BR \-o,\ --data_offset=
-data offset in sectors
+.BR \-l\ --label=LABEL
+Create the filesystem with the specified label
-.BR \--cset-uuid=
-Create a cache device with the specified UUID
+.BR \--uuid=UUID
+Create the filesystem with the specified UUID
-.BR \--csum_type=
-One of none, csc32c, or csc64
+.BR \--force
+Force the filesystem to be created, even if the device already contains a
+.SH Options that apply to subsequent devices:
-.BR \--meta-replicas=
-Number of metadata replicas
+.BR \--fs_size=SIZE
+Create the filesystem using SIZE bytes on the subsequent device
-.BR \--data-replicas=
-Number of data replicas
+.BR \-b\ --bucket-size=SIZE
+Specifies the bucket size - must be greater than the btree node size
-.BR \--wipe-bcache
-Destroy existing bcache data if present
+.BR \-t,\ --tier=INDEX
+Specifies the tier of subsequent devices, where INDEX is a small integer and a
+smaller index indicates a faster tier - tier 0 being the fastest. Currently only
+two tiers are supported.
.BR \--discard
-Enable discards
-.BR \--writeback
-Enable writeback
+Enable discards on subsequent devices
.SH Options for register
@@ -117,7 +119,7 @@ Provide a directory other than /sys/fs/bcache
.SH Options for query-devs
.BR \-f,\ --force-csum
-Enables bcacheadm to going even if the superblock crc is invalid
+Enables bcache to going even if the superblock crc is invalid
.SH Options for status
diff --git a/debian/control b/debian/control
index 4a138f6..3e9b294 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,8 @@ Uploaders: Robie Basak <>
Section: utils
Priority: optional
Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9), pkg-config, uuid-dev, libblkid-dev
+Build-Depends: debhelper (>= 9), pkg-config, libblkid-dev, uuid-dev, libnih-dev,
+ libscrypt-dev, libsodium-dev, libkeyutils-dev
Vcs-Git: git://
diff --git a/debian/rules b/debian/rules
index 61f3011..4f2c774 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,3 @@
dh $@
- dh_auto_install -- DRACUTLIBDIR=/usr/lib/dracut
diff --git a/mkfs.bcache b/mkfs.bcache
new file mode 100755
index 0000000..411c151
--- /dev/null
+++ b/mkfs.bcache
@@ -0,0 +1,3 @@
+exec bcache format "$@"