Nathan Shearer


BImage is a bash script that makes creating, restoring, mounting, and unmounting compressed images easy. When creating images, it reads everything off of the source device with dd or ddrescue and compresses the raw image with gzip. The image can then be mounted or easily restored to the original device or to another device.


  • Creating compressed images from a source device with dd or ddrescue (in case the device has bad sectors).
    • The images are exact binary copies of the input device. Extra information like serial number, and SMART data is also bundled with the image.
  • Usefull output indicates progress and estimated time remaining.
  • E-mail notifications indicate progress or errors.
  • Adjusting the compression level.
  • Throttling the IO throughput.
  • Restoring the compressed images to another device.


  • bar
  • ddrescue
  • gzip
  • hdparm
  • ide-smart
  • sdparm
  • tar


To install BImage simply run the following commands:

# sudo wget "" -O /usr/bin/bimage
# sudo chmod a+x /usr/bin/bimage


BImage has two optional configuration files: /etc/bimage/bimage.conf and ~/.bimage.conf. First the one in /etc is sourced, then your local .bimage.conf is sourced. This allows you to have a system wide configuration and user specific configurations. The config files follow shell script syntax to set variables. Note that all the variables are optional

Example configuration file:

# Regulate the speed of compression using the specified digit, where 1
# indicates the fastest compression method and 9 indicates the best
# compression method. The default compression level is 6.

# Some tasks can run for a long time. An email will be sent when
# each phase completes.

# Add integer N to the niceness (default 20).

# Use ddrescue instead of dd to read the image. This can be useful if your
# source device has bad sectors.

# Restrict I/O throughput to bytes per second. may be followed
# by 'k', 'm', 'g', 't', 'p', or 'e' for kilobytes, megabytes, gigabytes,
# terabytes, petabytes, or exabytes, respectively. There is no throttle by
# default.


The latest version of BImage can be downloaded here. To install BImage simply place the script in /usr/bin and you can execute it from anywhere on your system.
% Powered by Modulus %
© 2022 Nathan Shearer