Zbox is a zero-details, privacy-focused embeddable file system. Its goal is to help application store files securely, privately and reliably. By encapsulating files and directories into an encrypted repository, it provides a virtual file system and exclusive access to authorised application.
Unlike other system-level file systems, such as [ext4], [XFS] and [Btrfs], which provide shared access to multiple processes, Zbox is a file system that runs in the same memory space as the application. It only provides access to one process at a time.
By abstracting IO access, Zbox supports a variety of underlying storage layers. Memory and OS file system are supported now, RDBMS and key-value object store supports are coming soon.
Zbox is under active development, we are not responsible for any data loss or leak caused by using it. Always back up your files and use at your own risk!
Many OS-level file systems support encryption, such as [EncFS], [APFS] and [ZFS]. Some disk encryption tools also provide virtual file system, such as [TrueCrypt], [LUKS] and [VeraCrypt].
This diagram shows the difference between Zbox and them.
Below is the feature comparison list.
| | Zbox | OS-level File Systems | Disk Encryption Tools | | --------------------------- | ------------------------ | ------------------------ | ------------------------ | | Encrypts file contents | :heavycheckmark: | partial | :heavycheckmark: | | Encrypts file metadata | :heavycheckmark: | partial | :heavycheckmark: | | Encrypts directory | :heavycheckmark: | partial | :heavycheckmark: | | Data integrity | :heavycheckmark: | partial | :heavymultiplicationx: | | Shared access for processes | :heavymultiplicationx: | :heavycheckmark: | :heavycheckmark: | | Deduplication | :heavycheckmark: | :heavymultiplicationx: | :heavymultiplicationx: | | Compression | :heavycheckmark: | partial | :heavymultiplicationx: | | Versioning | :heavycheckmark: | :heavymultiplicationx: | :heavymultiplicationx: | | COW semantics | :heavycheckmark: | partial | :heavymultiplicationx: | | ACID Transaction | :heavycheckmark: | :heavymultiplicationx: | :heavymultiplicationx: | | Multiple storage layers | :heavycheckmark: | :heavymultiplicationx: | :heavymultiplicationx: | | API access | :heavycheckmark: | through VFS | through VFS | | Symbolic links | :heavymultiplicationx: | :heavycheckmark: | depends on inner FS | | Users and permissions | :heavymultiplicationx: | :heavycheckmark: | :heavycheckmark: | | FUSE support | :heavymultiplicationx: | :heavycheckmark: | :heavycheckmark: | | Linux and macOS support | :heavycheckmark: | :heavycheckmark: | :heavycheckmark: | | Windows support | :heavycheckmark: | partial | :heavycheckmark: |
For reference documentation, please visit documentation.
32-bit and other OS are NOT
supported yet.
Add the following dependency to your Cargo.toml
:
toml
[dependencies]
zbox = "0.3.0"
```rust extern crate zbox;
use std::io::{Read, Write}; use zbox::{init_env, RepoOpener, OpenOptions};
fn main() { // initialise zbox environment, called first init_env();
// create and open a repository in current OS directory
let mut repo = RepoOpener::new()
.create(true)
.open("file://./my_repo", "your password")
.unwrap();
// create and open a file in repository for writing
let mut file = OpenOptions::new()
.create(true)
.open(&mut repo, "/my_file.txt")
.unwrap();
// use std::io::Write trait to write data into it
file.write_all(b"Hello, world!").unwrap();
// finish writing to make a permanent version of content
file.finish().unwrap();
// read file content using std::io::Read trait
let mut content = String::new();
file.read_to_string(&mut content).unwrap();
assert_eq!(content, "Hello, world!");
} ```
Zbox comes with Docker support, it is based on [rust:latest] and [libsodium] is included. Check the Dockerfile for the details.
First, we build the Docker image which can be used to compile Zbox, run below
commands from Zbox project folder.
bash
docker build --force-rm -t zbox ./
After the Docker image is built, we can use it to build Zbox.
bash
docker run --rm -v $PWD:/zbox zbox cargo build
Or run the test suite.
bash
docker run --rm -v $PWD:/zbox zbox cargo test
By default, Zbox uses dynamic linking when it is linked with libsodium. If you want to change this behavior and use static linking, you can enable below two environment variables.
On Linux/macOS,
bash
export SODIUM_LIB_DIR=/path/to/your/libsodium/lib
export SODIUM_STATIC=true
On Windows,
bash
set SODIUM_LIB_DIR=C:\path\to\your\libsodium\lib
set SODIUM_STATIC=true
And then re-build the code.
bash
cargo build
The performance test is run on a Macbook Pro 2017 laptop with spec as below.
| Processor Name: | Intel Core i7 | | Processor Speed: | 3.5 GHz | | Number of Processors: | 1 | | Total Number of Cores: | 2 | | L2 Cache (per Core): | 256 KB | | L3 Cache: | 4 MB | | Memory: | 16 GB | | OS Version: | macOS High Sierra 10.13.3 |
Performance test result:
memcpy: read: 3798.3032 MB/s, write: 3798.3032 MB/s file system: read: 923.0447 MB/s, write: 2373.3384 MB/s
read: 343.65326 MB/s, write: 163.1137 MB/s
read: 167.211 MB/s, write: 130.36934 MB/s
To run the performance test on your own computer, please follow the instructions in CONTRIBUTING.md.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms of conditions.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Zbox
is licensed under the Apache 2.0 License - see the LICENSE
file for details.