image_writer_rs

Crates.ioimage_writer_rs
lib.rsimage_writer_rs
version1.0.5
created_at2025-07-31 07:49:45.547058+00
updated_at2025-08-16 15:37:14.300858+00
descriptionWrite bootable OS images to USB drive (dd on steroids)
homepage
repositoryhttps://github.com/p-kraszewski/image_writer_rs.git
max_upload_size
id1774569
size60,785
Paweł Kraszewski (p-kraszewski)

documentation

README

image_writer_rs

Warning

WARNING WARNING WARNING

The code assumes:

  • You run it on Linux
  • The /dev/disk/by-id/ directory exists and is properly populated
  • The /sys/block/ directory exists and is properly populated

Features

  • Autodetect any writable USB mass storage with non-zero capacity, show choice when more than 1 detected.
  • Show warning with exact detected device name and countdown before writing an image - you have 10 seconds to ^C if you change your mind.
  • Warn if the disk image appears to not be bootable (missing 0x55AA signature in the first sector)
  • Abort if (eventually decompressed) disk image is not a multiple of 512 bytes.
  • Support various disk image types (extension is case-insensitive):
    • Uncompressed: .ISO, .FS, .IMG, .IMA, .DD, .BIN, .RAW
    • Compressed: .BZ2, .BZIP2, .GZ, .GZIP, .XZ, .LZMA, .PIXZ, .ZST, .ZSTD, .LZ4
  • All images need to be in RAW format (after the eventual decompression).
  • Write directly to the device, bypassing cache.
  • Verify written data against the original image.

TODO

  • Check if image fits on media.
  • Optionally fix the secondary GPT partition table to end of written media (warning - will invalidate checksum as it must modify the primary GPT partition)
  • Support VM partition images (like qcow2 or vmdk) - that is copy virtual disk to a physical one.
Commit count: 0

cargo fmt