CITATION: https://btrfs.wiki.kernel.org/index.php/Btrfs-image

Text in red is my information/notes.

Btrfs-image

Makes a compressed image of a btrfs partition (zeroed data).

More info by me: This will only backup image the METADATA (and possibly SYSTEM as well) but not DATA chunks. Thus the data will appear as zeroed out data if you take the btrfs image and restore it to a file with -r and mount the restored btrfs image – so you will see your folder and file structure (As that is kept in the metadata) but all of your files will have nothing in them (as data is zeroed out). [if you mount it from the same system where the data is, then the data will be accessible as the extents will point to the drives]. This file is useful for devs to look at.

Usage – image

Description of parameters

  • “-r”: Restore a previously made image (this makes a file which is a alike to dding a filesystem)
  • “-c”: Level of compression from 0=none over 1=lowest zlib to 9=highest zlib
  • “-t”: Number of threads used 1 to 32 (defaults to number of cpus)
  • source: when used without -r it is the device that has the btrfs filesystem on it. when used with the -r, source is the btrfs-image (which was the output or destination parameter of a previous btrfs-image command)
  • destination: its the output file. When used without -r this names the final btrfs-image file. When used with the -r this names the btrfs dd

Everything below is my addition

Usage – example making btrfs-image

Usage – example restore btrfs-image

  • If mounted on the same system, the data might be accessible from /mnt as it points to the extents from a disk. Now if you mount it from another location it will be zeroed out data.
  • Side note: the 115 gig size of the restored btrfs-image makes sense because the “btrfs fi df /vol” output of the /dev/sda5 volume showed to me the following output:

Leave a Reply

Your email address will not be published. Required fields are marked *