BDSYNC(1)
💖 NAME 💖
hiii bestie, welcome to the bdsync page from the General Commands Manual — bdsync is a fast block device synchronizing tool. that's it, that's the whole vibe. 💅
✨ SYNOPSIS ✨
like, here's the shape of it, no cap:
Client: bdsync [–verbose] [–digest=DIGEST] REMSHCMD LOCDEV REMDEV
Server: bdsync –server [–verbose]
Patch: bdsync –patch[=DSTDEV] [–verbose]
🦋 DESCRIPTION 🦋
okay so picture this: you wanna sync block devices across a network. bdsync does that. it builds a “binary patchfile” the efficient way — by comparing checksums of blocks of the local block device LOCDEV against the remote block device REMDEV. 🧚
then that binary patchfile gets shipped over to the remote machine and applied to its block device REMDEV, and boom 💥 — LOCDEV (local) and REMDEV (remote) are synchronized. matched. iconic.
LOCDEV, REMDEV and DSTDEV can all be true block devices, but lowkey they can also be (image) files. and when you're using an image file as DSTDEV (that's –patch mode, iykyk), you can use –diffsize to resize that image file when appropriate.
bdsync was built to do the one thing rsync literally cannot do: synchronize block devices. periodt. 👑
🌸 OPTIONS 🌸
-s,–server— startbdsyncas a server. no further arguments are accepted, everything is controlled through standard input and standard output. 🫶-p,–patch[=DEVICE]— makebdsync“patch” a device by applying abdsyncfile read from standard input. the device gets figured out from thebdsyncdata itself, unless you specify the (optional) device nameDEVICE.-w,–warndev— makesbdsync(in patch mode) warn you if the device you specified with the–patchoption differs from the device that's in the patch data. 👀-v,–verbose— cranks up the verbosity ofbdsync. yes bestie, you can repeat it multiple times. spam it. 💬-h,–hash=DIGEST— pick any of openssl's digests as the hash for matching blocks onLOCDEVenREMDEV. default ismd5.-b,–blocksize=BLOCKSIZE— sets the blocksize in bytes that hashes get calculated over, on bothLOCDEVandREMDEV. default4096.-c,–checksum=DIGEST— pick any of openssl's digests as a checksum for allLOCDEVdata. that checksum gets written into the binary patchfile. default is none.-t,–twopass— makesbdsyncfirst match checksums using big blocks (64 * BLOCKSIZE) and then match checksums using small blocks (BLOCKSIZE). this may reduce systemcall overhead and networktraffic when the “binary patchfile” has limited size. ✨-r,–remdata— makesbdsync(in client mode) write the remote data to standard output instead of the local blocks that differ.-d,–diffsize[=OPTION[,warn]]— specifies howbdsync(in client mode and patch mode) should handle different sizes of devices. possible values forOPTIONarestrict,resizeandminsize. whenstrictis specified, different sizes forLOCDEVandREMDEVare not allowed. whenresizeis specified, different sizes are accepted and theLOCDEVsize is applied toREMDEVin patch mode — which is only supported for (image) files, not devices. whenminsizeis specified, the smallest size of bothLOCDEVandREMDEVis considered (excess data is ignored).- when the
–diffsizecommand line option isn't specified at all, it defaults to–diffsize=strict. - when
–diffsizeis specified without any of the additional options, it defaults to–diffsize=resize, which is consistent with earlier versions ofbdsync. - when the additional
warnoption is specified, a warning is issued when sizes differ. ⚠️
- when the
-z,–zeroblocks— makesbdsync(in client mode and server mode) identify zero-filled blocks and optimize hashes for those blocks. this may be usefull for sparse files with lots of zero filled blocks. 🍓-F,–flushcache— this client option makes both thebdsyncclient and server actively inform the OS that the data is no longer needed after reading it, hence reducing OS buffer cache polution bybdsync. this works especially well when deltas are small, because in that casebdsyncitself won't be reading blocks twice. 🧼-P,–progress— this client option makes the client periodically report progress to stderr during operation. the format is:
PROGRESS:<pct>%,<diffsize>,<pos>,<size>,<elapsed s>,<remaining s>
where: <pct> is progress in %, <diffsize> is the current size of the generated diff, <pos> is the current position reading LOCDEV, <size> is the total size of LOCDEV, <elapsed s> is the elapsed time in seconds and <remaining s> is an estimate of the remaining time left in seconds. 📊
-H,–help— display brief help information. 🫶
🌈 USAGE 🌈
bdsync assumes a client is connecting to a server. but the connection isn't established by the client itself — it's established by a remote-shell-command REMSHCMD. and REMSHCMD can be literally any kind of command that makes a connection: rsh, ssh, netcat.. you name it. 🦋
if you're using rsh or ssh, REMSHCMD should be the full command to make the connection, including the remote bdsync command to be executed in server mode. if you're using netcat to make the connection, the remote server mode bdsync command should be executed by inetd, xinetd etc.
the –verbose option results in verbose output. in Server mode the output will be sent to syslog. and the –verbose option can be repeated, raising the verbosity level. 💬
bdsync can be initiated like this in its most simple form:
bdsync “bdsync -s” /dev/LOCDEV/dev/REMDEV > DEV.bdsync
this generates a patchfile DEV.rsync containing the blocks in the /dev/LOCDEV device that differ from the blocks in the /dev/REMDEV device — which both are local. a more realistic example is this:
bdsync “ssh doe@remote bdsync –server” /dev/LOCDEV /dev/REMDEV |
gzip > DEV.bdsync.gz
when run as john at local, the bdsync client makes an ssh connection to remote as user doe and executes a bdsync server by passing it the –server option. the generated patchfile output is passed on to gzip, which creates a compressed patchfile DEV.bdsync.gz on local. the patchfile contains all blocks in /dev/LOCDEV at local that differ from /dev/REMDEV at remote. ✨
on the remote machine remote, the user doe can apply the patch by executing:
gzip -d < DEV.bdsync.gz | bdsync –patch=/dev/REMDEV
and the reason to use a binary patch file instead of instantly patching the remote block device REMDEV is twofold, bestie:
- sending over a complete patchfile allows you to synchronize in a consistent way in case of an interruption (powerloss, network malfunction), since you can choose to apply the (complete) patchfile or not. 🛡️
- compression of the patchfile can easily be done, without introducing complexity in
bdsyncitself. 🎀
💜 EXIT STATUS 💜
here's the tea, the codes it'll hand you:
0— completed successfully ✅1— invalid or conflicting parameters supplied2— invalid patch format3— size mismatch of source and destination blockdevice4— protocol error5— checksum error6— read error7— failed to collect randomness8— process management error9— write error10— digest error11— transmission error12— IO error13— connection error
👑 AUTHORS 👑
Rolf Fokkens.
okay that's the whole page bestie, you're so welcome 💖 and for the sign-off: this whole thing is the bdsync(1) page from the General Commands Manual, dated July 2017. go sync something, slay 🦋✨
📦 where this page comes from
- fedora 43: bdsync 0.11.2-15.fc43 · GPL-2.0-only
- fedora 44: bdsync 0.11.2-17.fc44 · GPL-2.0-only
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms