BTRFS-RECEIVE(8)

πŸ’– BTRFS-RECEIVE(8) πŸ’–

okay bestie, pull up a chair, because we're talking about btrfs-receive β€” the receiving half of the btrfs send/receive duo, straight out of the BTRFS manual section. she's the one who catches the stream and makes a whole subvolume out of it. main character energy, no cap. πŸ¦‹


✨ NAME ✨

btrfs-receive β€” receive subvolumes from send stream 🌸


πŸŽ€ SYNOPSIS πŸŽ€

btrfs receive [options] <path>

or

btrfs receive --dump [options]

πŸ’… DESCRIPTION πŸ’…

So basically, btrfs receive takes a stream of changes and replicates one or more subvolumes that were, at some point, generated by btrfs send. The received subvolumes get stored into path β€” unless you handed it the --dump option, in which case we're just vibing in read-only mode, iykyk.

If --dump is specified, btrfs receive will only do the validation of the stream and print the stream metadata, one operation per line. That's it. No filesystem changes, just receipts. πŸ’€

Now, the ways this can go wrong β€” because bestie, she will fail in these cases:

  1. receiving subvolume already exists πŸ™ˆ
  2. previously received subvolume has been changed after it was received 😭
  3. default subvolume has changed, or you didn't mount the filesystem at the toplevel subvolume πŸ’€

A subvolume is made read-only after the receiving process finishes successfully β€” see BUGS below for the tea on that. πŸ”₯


✨ Options ✨

  • -f <FILE> β€” read the stream from FILE instead of stdin, so you're not stuck piping things in like a peasant 🫢
  • -C, --chroot β€” confine the process to path using chroot(1) <https://man7.org/linux/man-pages/man1/chroot.1.html>. lil jail cell, adorable πŸ’–
  • -e β€” terminate after receiving an end cmd marker in the stream.

Without this option, the receiver side terminates only in case of an error on end of file. so like... she just keeps going until something explodes 😭

  • -E, --max-errors <NERR> β€” terminate as soon as NERR errors occur while stream processing commands from the stream.

Default value is 1. A value of 0 means no limit. (no limit?? brave. iconic but brave. πŸ’€)

  • -m <ROOTMOUNT> β€” the root mount point of the destination filesystem.

By default the mount point is searched in /proc/self/mounts. If /proc is not accessible, e.g. in a chroot environment, use this option to tell us where this filesystem is mounted. ✨

  • --force-decompress β€” if the stream contains compressed data (see --compressed-data in btrfs-send(8) <>), always decompress it instead of writing it with encoded I/O 🧚
  • --dump β€” dump the stream metadata, one line per operation.

Does not require the path parameter. The filesystem remains unchanged. Each stream command is on one line in the form of key=value and separated by one or more spaces. Values that contain special characters (like paths or extended attributes) are encoded in a C-like way, e.g. '\n' or an octal escape sequence like '\NNN' where N is the char value. Same encoding as is used in /proc files. nerd moment but honestly? slay. πŸ‘‘

  • -q, --quiet β€” (deprecated) alias for global -q option ⚠️
  • -v β€” (deprecated) alias for global -v option ⚠️

🌈 Global options 🌈

  • -v, --verbose β€” increase verbosity about performed actions, print details about each operation. she's telling you everything 🫢
  • -q, --quiet β€” suppress all messages except errors. minimalism era πŸ’œ

πŸ”₯ BUGS πŸ”₯

btrfs receive sets the subvolume read-only after it completes successfully. However, while the receive is in progress, users who have write access to files or directories in the receiving path can add, remove, or modify files β€” in which case the resulting read-only subvolume will not be an exact copy of the sent subvolume. 😭 bestie. the vibes are off.

If the intention is to create an exact copy, the receiving path should be protected from access by users until the receive operation has completed and the subvolume is set to read-only. lock it down, queen. πŸ”’

Additionally, receive does not currently do a very good job of validating that an incremental send stream actually makes sense, and it is thus possible for a specially crafted send stream to create a subvolume with reflinks to arbitrary files in the same filesystem. πŸ’€πŸ’€πŸ’€

Because of this, users are advised to not use btrfs receive on send streams from untrusted sources, and to protect trusted streams when sending them across untrusted networks.

like, genuinely. this is the real warning. do not skip it. 🚨


πŸ’– EXIT STATUS πŸ’–

btrfs receive returns a zero exit status if it succeeds. Non zero is returned in case of failure. that's the vibe check: 0 = she ate, anything else = she did not. ⭐


πŸ¦‹ AVAILABILITY πŸ¦‹

btrfs is part of btrfs-progs. Please refer to the documentation at <https://btrfs.readthedocs.io>. πŸ“š


πŸ‘‘ SEE ALSO πŸ‘‘

btrfs-send(8) <> , mkfs.btrfs(8) <> β€” go read those too, bestie, they're the other half of the story πŸŽ€


and that's the whole page!! this gorgeousness is from btrfs-progs version 7.3, dated Oct 24, 2026. mwah. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from