A very minimal GUI app that can write compressed disk images to USB drives https://bztsrc.gitlab.io/usbimager
bzt fc920b2117 Updated readme | 9 달 전 | |
---|---|---|
src | 9 달 전 | |
.gitignore | 1 년 전 | |
LICENSE | 4 년 전 | |
OLVASSEL.md | 9 달 전 | |
README.md | 9 달 전 | |
donate.png | 1 년 전 | |
usbimager-manual.pdf | 1 년 전 | |
usbimager.png | 1 년 전 |
USBImager is a really really simple GUI application that writes compressed disk images to USB drives and creates backups. Available platforms: Windows, MacOSX and Linux. Its interface is as simple as it gets, totally bloat-free.
Platform | Frontend | Description |
---|---|---|
Windows | GDI GDI wo |
native interface simplified, write-only interface |
MacOSX | Cocoa Intel Cocoa ARM |
for older Mac models for newer Mac models |
Ubuntu LTS | GTK+ GTK+ wo |
same as the Linux PC GTK version with udisks2 support, but in .deb format simplified, write-only interface |
RaspiOS | GTK+ GTK+ wo |
same as the Raspberry Pi GTK version with udisks2 support, but in .deb format simplified, write-only interface |
Arch/Manjaro | GTK+ GTK+ X11 |
same as the Linux PC GTK version with udisks2 support, but in an AUR package generated from the binaries minimal X11 version |
Linux PC | X11 X11 wo X11 uf X11 wo uf GTK+ |
recommended simplified, write-only interface with embedded Unifont, +512K simplified interface with embedded Unifont, +512K compatibility (requires udisks2) |
Raspberry Pi | X11 X11 wo X11 uf X11 wo uf X11 X11 wo X11 uf X11 wo uf |
AArch32 (armv7l), normal interface AArch32, simplified, write-only interface AArch32, normal, with embedded Unifont, +512K AArch32, simplified, with embedded Unifont, +512K AArch64 (arm64), normal interface AArch64, simplified, write-only interface AArch64, normal, with embedded Unifont, +512K AArch64, simplified, with embedded Unifont, +512K |
NOTE: I have to say a few words on this, because this question is keep popping up constantly: Why not just use dd
? My answers:
dd
isn't cross-platform (for example not on Windows, so disk-writing requires an application anyway).dd
can't use compressed image files on-the-fly (yes, yes, I can use pipes, but average Joe can't).dd
can't verify if the write was successful.dd
doesn't guarantee that the data is actually physically written to the storage (not unless you use some additional options).dd
doesn't stop you from making a terrible mistake (which is perfect for an expert, but not so much for a needs-to-image-once-in-a-century folks).dd
, it is a fully-featured native application on all platforms.NOTE: forever returning problem: the GTK version works, but the X11 version only shows boxes (or nothing) instead of text. This isn't an USBImager issue, rather X11 fontconfig problem. Solutions:
unifont-*.pcf.gz
from here,
copy it under /usr/share/fonts/misc
(or into any other directory listed by fc-list
) and execute the fc-cache -vf
command to
update the font cache. After this USBImager should be able to find and use this font on its own.usbimager_*.zip
archives from the repo for your desktop (less than 192 Kilobytes each)C:\Program Files
(Windows), /Applications
(MacOSX) or /usr
(Linux)You can use the executable in the archive as-is, the other files only provide integration with your desktop (icons and such). It will autodetect your operating system's configured language, and if dictionary found, it will greet you in your language.
On Ubuntu LTS and Raspbian machines you can also download the deb version, which then can be installed by the
sudo dpkg -i usbimager_*.deb
command.
If you like it or find it useful, your donation of any amount will be very much appreciated:
BTC 3EsdxN1ZsX5JkLgk3uR4ybHLDX5i687dkx
(* - for archives with multiple files, the first file in the archive is used as input)
With xz compression dictionaries bigger than 1 Gigabytes not supported (the default xz dictionary size is 64 Mb).
Description | balenaEtcher | WIN32 Disk Imager | USBImager |
---|---|---|---|
Multiplatform | ✔ | ✗ | ✔ |
Minimum Windows | Win 7 | Win XP | Win XP |
Minimum MacOSX (1) | 10.15 | ✗ | 10.10 |
Available on Raspbian | ✗ | ✗ | ✔ |
Program size (2) | 130 Mb | ✗ | 300 Kb |
Dependencies | lots, ~300 Mb | Qt, ~8 Mb | ✗ none |
Spyware-free and ad-free | ✗ | ✔ | ✔ |
Native interface | ✗ | ✗ | ✔ |
Guarantee on data writes (3) | ✗ | ✗ | ✔ |
Verify data written | ✔ | ✗ | ✔ |
Compressed images | ✔ | ✗ | ✔ |
Raw write time (4) | 23:16 | 23:28 | 24:05 |
Compressed write time (4) | 01:12:51 | ✗ | 30:47 |
(1) - for Intel: the provided binary was compiled under 10.14 (because that's what I have), however it was reported that you can compile the source under 10.13 too without problems. Furthermore, Tarnyko also successfully tested it under 10.10. For ARM: the minimum version is 11.0. As of 1.0.9, the Intel version isn't supported any more, and the ARM version is maintained by @cwongmath.
(2) - the portable executable's size on Windows platform. I couldn't download an official pre-compiled version of WIN32 Disk Imager, just the source. The uf versions of USBImager are bigger, ~800K, because they include Unifont.
(3) - USBImager uses only non-buffered IO operations to make sure data is physically written to disk
(4) - measurements performed by @CaptainMidnight on Windows 10 Pro using a SanDisk Ulta 32GB A1 device. Raw image file size was 31,166,976 Kb, the bzip2 compressed image size was 1,887,044 Kb. WIN32 Disk Imager was unable to uncompress the image file, therefore the resulting card was unbootable.
If you can't write to the target device (you get "permission denied" errors), then:
Windows: right-click on usbimager.exe and use the "Run as Administrator" option.
MacOSX: because the "Full Disk Access" doesn't work and Apple refuses to fix it for years now, the app runs sudo
/Applications/USBImager.app/Contents/MacOS/usbimager by itself. This always works from Terminal. If it does not start by any chance, then you have to set the
SUDO_ASKPASS
environment variable (newer MacOS sets this by default, but under Catalina and before you might need to set it manually). If you get
"USBImager.app" is damaged and can't be opened. error message, then that's because Finder adds a quarantine tag by default. To remove, in a Terminal run
/usr/bin/xattr -crv /Applications/USBImager.app
and everything will be fine.
Linux: this should not be an issue as USBImager comes with setgid bit set. If not, then you can use sudo chgrp disk usbimager && sudo chmod g+s usbimager to set it. Alternatively add your user to the "disk" group (see "ls -la /dev|grep -e ^b" to find out which group your OS is using). Should be no need for sudo /usr/bin/usbimager, just make sure your user has write access to the devices, that's the Principle of Least Privilege.
If your drive does not show up in the list, then it might be too big or might be the system disk. The '-m' flag can be used to set what is considered too big. For example '-m1024' allows you to select all disks that are smaller than 1 Terrabyte. The '-a' flag (all) turns off filtering, and allows you to select any device; warning, even the system disks!
For X11 I made everything from scratch to avoid dependencies. Clicking and keyboard navigation works as expected: Tab and Shift + Tab switches the input field, Enter selects. Plus in Open File dialog Left / BackSpace goes one directory up, Right / Enter goes one directory down (or selects the item if it's not a directory). You can use Shift + Up / Down to change the sorting order. "Recently Used" files also supported (through freedesktop.org's Desktop Bookmarks Standard).
With this operation, the file format and the compression is autodetected. Please note that the remaining time is just an estimate. Some compressed files do not store the uncompressed file size, for those you will see "x MiB so far" in the status bar. Their remaining time will be less accurate, just an approximation of an estimation using the ratio of compressed position / compressed size (in short it is truly nothing more than a rough estimate).
If "Verify" is clicked, then each block is read back from the disk and compared to the original image.
The last option, the selection box selects the buffer size to use. The image file will be processed in this big chunks. Keep in mind that the actual memory requirement is threefold, because there's one buffer for the compressed data, one for the uncompressed data, and one for the data read back for verification.
The generated image file is in the form "usbimager-(date)T(time).dd", generated with the current timestamp. If "Compress" option is checked, then a ".zst" suffix will be added, and the image will be compressed using ZStandard. It has much better compression ratio than gzip deflate. For raw images the remaining time is accurate, however for compression it highly depends on the time taken by the compression algorithm, which in turn depends on the data, so remaining time is just an estimate.
Note: on Linux, if ~/Desktop is not found, then ~/Downloads will be used. If even that doesn't exists, then the image file will be saved in your home directory. On other platforms the Desktop always exists, but if by any chance not, then the current directory is used. On all platforms, if an existing directory is specified on the command line, that is used to save backups.
Flag | Description |
---|---|
-v/-vv | Be verbose |
-Lxx | Force language |
-1..9 | Set buffer size |
-m(gb) | Maximum disk size |
-a | List all devices |
-f | Force write |
-s[baud]/-S[baud] | Use serial devices |
-F(xlfd) | Specify X11 font |
--version | Prints version |
(dir) | First non-flag is the backup directory |
For Windows users: right-click on usbimager.exe, and select "Create Shortcut". Then right-click on the newly created ".lnk" file, and select "Properties". On the "Shortcut" tab, in the "Target" field, you can add the flags. On the "Security" tab, you can also set to run USBImager as Administrator if you have problems accessing the raw disk devices.
Flags can be given separately (like "usbimager -v -s -2") or at once ("usbimager -2vs"), the order doesn't matter. For flags that set the same thing, only the last taken into account (for example "-124" is the same as "-4").
The first argument which is not a flag (does not start with '-') is used as the backup image directory.
The '-m' allows you to specify the maximum disk size in Gigabytes. Any disk bigger than this will be considered a large disk (by default 256 Gigabytes).
With '-a', all devices will be listed, even system disks and large disks. With this you can seriously damage your computer, be careful!
The '-v' and '-vv' flags will make USBImager to be verbose, and it will print out details to the console. That is stdout on Linux and MacOSX (so run this in a Terminal), and on Windows a spearate window will be opened for messages.
The last two character of '-Lxx' flag can be "en", "es", "de", "fr" etc. Using this flag forces a specific language dictionary and avoids automatic detection. If there's no such dictionary, then English is used.
The number flags sets the buffer size to the power of two Megabytes (0 = 1M, 1 = 2M, 2 = 4M, 3 = 8M, 4 = 16M, ... 9 = 512M). When not specified, buffer size defaults to 1 Megabyte.
By default, one block of data is read in, compared to the buffer, and only written if they differ. This is useful on media which are very slow to write, have limited write cycles, but fast to read. With the '-f' force flag this comparision is ommited, and the data is always written to the disk.
If you start USBImager with the '-s' flag (lowercase), then it will allow you to send images to serial ports as well. For this, your user has to be the member of the "uucp" or "dialout" groups (differs in distributions, use "ls -la /dev/|grep tty" to see which one). In this case on the client side:
The '-S' flag (uppercase) is similar, but then USBImager will do a raspbootin hand-shake on the serial line:
For both case the serial line is set to 115200 baud, 8 data bits, no parity, 1 stop bit. For serial transfers, USBImager does not uncompress the image to minimize transfer times, so that has to be done on the client side. For a simple boot loader that's compatible with USBImager, take a look at Image Receiver (available for RPi1, 2, 3, 4 and IBM PC BIOS machines). Also used to send emergency initial ramdisks to BOOTBOOT compliant boot loaders.
If you want to use a different baud, just simply add it to the flag, like "-s57600" or "-S230400". Valid values are: 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000
WARNING: not every serial port supports all baud rates. Check you device's manual.
The '-F(xlfd)' (font) flag allows to manually specify which X11 font to use (X11 variants only). Make sure that the specified XLFD ends in "iso10646-1", because only UNICODE fonts supported. For example (quotes needed so that the shell won't try to resolve the asterix):
./usbimager "-F-*-*-*-r-*-*-18-*-*-*-*-*-iso10646-1" -v
Please refer to the Appendix in the manual.
None. If you find any, please use the issue tracker.
I'd like to say thanks to @mattmiller, @MisterEd, @the_scruss, @rpdom, @DarkElvenAngel, @9001, and especially to @tvjon, @CaptainMidnight and @gitlabhack for testing USBImager on various platforms with various devices.
My thanks for checking and fixing the translations goes to: @mline, @vordenken (German), @epoch1970 and @JumpZero (French), @hansotten and @zonstraal (Dutch), @ller (Russian), @zaval (Ukrainian), @lmarmisa (Spanish), @otani, @hrko99 (Japanese), @ngedizaydindogmus (Turkish), @coltrane (Portuguese), @Matthaiks (Polish), @tomasz86 (Korean), @flaribbit (Chinese), @kaneda44 (Catalan).
Further thanks to @munntjlx, @lfomartins, @luckman212 and @tshup for compiling USBImager on MacOS for me, and to @tido- for the Ubuntu debs when my VirtualBox was broken.
And thanks to @cwongmath and @tshup, for the help they've provided with the macOS version. Thanks!
Bests,
bzt