{"id":37201381,"url":"https://github.com/nixomose/compressblockdevice","last_synced_at":"2026-01-14T23:13:18.897Z","repository":{"id":213952577,"uuid":"474414503","full_name":"nixomose/compressblockdevice","owner":"nixomose","description":"create a block device that compresses the data stored in it so it takes up less space that the block device exposes.","archived":false,"fork":false,"pushed_at":"2022-08-26T18:02:25.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-24T16:32:29.058Z","etag":null,"topics":["block-device","storage"],"latest_commit_sha":null,"homepage":"http://github.com/nixomose/compressbd","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nixomose.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-03-26T17:10:42.000Z","updated_at":"2023-12-24T16:32:32.023Z","dependencies_parsed_at":"2023-12-24T16:42:36.485Z","dependency_job_id":null,"html_url":"https://github.com/nixomose/compressblockdevice","commit_stats":null,"previous_names":["nixomose/compressblockdevice"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/nixomose/compressblockdevice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixomose%2Fcompressblockdevice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixomose%2Fcompressblockdevice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixomose%2Fcompressblockdevice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixomose%2Fcompressblockdevice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nixomose","download_url":"https://codeload.github.com/nixomose/compressblockdevice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nixomose%2Fcompressblockdevice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["block-device","storage"],"created_at":"2026-01-14T23:13:17.851Z","updated_at":"2026-01-14T23:13:18.828Z","avatar_url":"https://github.com/nixomose.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# compressblockdevice\ncreate a block device that compresses the data stored in it so it takes up less space that the block device exposes.\n\n# Building\ncd into compressblockdevice and \n\n`time go build compressblockdevice/cbd.go`\n\n# Dependencies\nall the go dependencies should be pulled in automatically upon building\n\nThe only other thing you need is zosbd2, the kernel module that creates the block device in the kernel and hands \nthe requests to the userspace program to service them.\n\nhttps://github.com/nixomose/zosbd2 \n\nInstructions to build the kernel module are all there.\n\n\n# Running\n\nthe build produces a cbd binary which you can put in your path so you can just run cbd from anywhere...\nAt the moment you have to be root to run cbd mostly because of interacting with the kernel module block device and the control device.\nOn my list of things to do is make it not require root, that should be possible as long as you can convey the user you want to use it as to the kernel module the first time. chicken and egg problem for another day.\n\n```\n./cbd  --help\ncbde allows you to define a catalog of block devices defining their size and backing store and lets you \neasily start up and shut down these block devices. \nrequires zosbd2 - https://github.com/nixomose/zosbd2\n\nUsage:\n  cbd [command]\n\nAvailable Commands:\n  catalog             list one or all of the devices defined in the catalog\n  completion          Generate the autocompletion script for the specified shell\n  destroy-all-devices destroy all block devices\n  destroy-device      destroy a block device by name\n  device-status       display status of all block devices\n  diag                diagnostic tools\n  help                Help about any command\n  storage-status      display definition of backing storage\n\nFlags:\n  -c, --config-file string   configuration file (default \"/etc/compressblockdevice/compressblockdevice.cf\")\n  -h, --help                 help for cbd\n  -l, --log-file string      log file (default \"/var/log/compressblockdevice/compressblockdevice.log\")\n  -v, --log-level uint32     log level: 0=debug 200=info 500=error (default 200)\n\n```\n\n# catalog\n\nthe catalog is just a list of definitions about a block device tied to a name so that you can define the block device characteristics once, and from then on refer to the block device definition by name. most regular usage of compressbd is through the catalog commands.\n\n```\n  add         add a catalog entry with this block device definition\n  delete      delete the specified catalog entry and its backing store\n  list        list one or all of the devices defined in the catalog\n  set         set a configuration or catalog entry option\n  start       create a block device with the definition specified by the device name in the catalog\n  stop        cleanly shutdown a currently running block device specified by the device name\n```\n\n# lower level access\n\n\n  ```destroy-device``` \nthis command tells the kernel module to cleanly end a block device. it will attempt to flush any in-flight requests but if they take too long to process, the block device will be pulled out from under you. so you should only call this once you've synced and unmounted any filesystems mounted to the block device.\n\n  \n  ```destroy-all-devices```  \n\nsame as above, but you don't specify a device name, it just goes through and destroys all the block devices, attempting to flush data first.\n  \n  \n \n  \n  ```device-status```\n  \ndisplay status of all existing block devices.\n \nexample output:\n  \n```\n./cbd device-status \n2022/08/09 20:51:11 {\"msg\":\"getting status for all block devices.\"}\n2022/08/09 20:51:11 {\"msg\":\"getting status for handle_id 2\"}\n{\n \"z5\": {\n  \"size_in_bytes\": 10737418240,\n  \"number_of_blocks\": 2621440,\n  \"kernel_block_size_in_bytes\": 4096,\n  \"max_segments_per_request\": 256,\n  \"timeout_in_milliseconds\": 1200000,\n  \"handle_id\": 2,\n  \"device_name\": \"z5\"\n }\n}\n```  \n  \n  \n```diag```\n\ndiagnostic tools\n\ndump the header of the stree backing the block device.\n\n```\n./cbd diag dump header -d z5\n    0: 5a454e53 54354b41 00000062 c2010000 00000004 00010030 0062af80 00000000  | ZENST5KA░░░b░░░░░░░░░░░0░b░░░░░░\n   32: 00000001 00010030 00000001                                               | ░░░░░░░0░░░░\n\n{\n \"0001_key\": \"    0: 5a454e53 54354b41  | ZENST5KA\\n\",\n \"0002_store_size_in_bytes\": \"424,161,640,448 0x00000062c2010000\",\n \"0003_nodes_per_block\": \"4 0x00000004\",\n \"0004_block_size\": \"65,584 0x00010030\",\n \"0005_block_count\": \"6,467,456 0x0062af80\",\n \"0006_root_node\": \"0 0x00000000\",\n \"0007_free_position\": \"1 0x00000001\",\n \"0008_alignment\": \"65,584 0x00010030\",\n \"0009_dirty\": \"1 0x00000001\"\n}\n```\n\n\n\n\n```storage-status```\n\ndisplay definition of backing storage\n  \n``` \n./cbd storage-status -t /home/nixo/testzosz5 \n{\n \"backing_storage\": \"/home/nixo/testzosz5\",\n \"dirty\": \"1\",\n \"inital_block_size_in_bytes\": \"65,584\",\n \"inital_nodes_per_block\": \"4\",\n \"inital_store_size_in_bytes\": \"424,161,640,448\",\n \"node_size_in_bytes\": \"327,920\",\n \"number_of_blocks_available_in_backing_store\": \"6,467,456\",\n \"number_of_physical_bytes_used_for_a_block\": \"65,584\",\n \"physical_store_block_alignment\": \"65,584\",\n \"total_bytes_wasted_due_to_alignment_padding\": \"0\",\n \"total_waste_percent\": \"0\",\n \"wasted_bytes_per_block\": \"0\"\n}\n```  \n  \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixomose%2Fcompressblockdevice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnixomose%2Fcompressblockdevice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnixomose%2Fcompressblockdevice/lists"}