Feature to write image to different size SD card?

Asked by Schorschi Decker on 2013-06-30

ImageWriter (Win32DiskImager) can't write a imaged file to a smaller SD card size then the original, even if the source image is shrunk? This seems odd, that ImageWriter only does absolute block referencing? Where a very simple partition map evaluation would make ImageWriter much more flexible.

Question information

Language:
English Edit question
Status:
Solved
For:
Image Writer Edit question
Assignee:
No assignee Edit question
Solved by:
Tobin Davis
Solved:
2013-07-01
Last query:
2013-07-01
Last reply:
2013-07-01
Best Tobin Davis (gruemaster) said : #1

ImageWriter was designed to only do block copies. At the time it was written, the only other tool available for WIndows was a console based app called rawwrite (or if you had cygwin you could use dd). It was never intended to make system partitions and copy files to new partitions. There are plenty of other apps for that now.

90% of the images this was designed for are pre-created images, often created on a Linux system where it is easy to create a file of X size then create partitions and file systems inside that file just as you would a raw device. This program can then take those images and write them in raw format to an SD/CF/USB memory device.

Adding the functionality you desire would require massive rewriting of code and also add more complex options to the user interface. We prefer to keep the interface as simple as possible. Sure, we can look into repartitioning and filesystem copying, ISO booting, etc, but that requires a lot more development resources that we simply don't have, just to create a program that mimics already existing apps.

Not exactly the answer I wanted. :) But I do understand the issues. Would be nice to have a product that did the partition oriented support. Maybe not this specific solution, but other another one. There seems to be a gap on the Windows platform for some thing as easy to use as ImageWriter but does something similar to dd.

Tobin Davis (gruemaster) said : #3

Similar to DD? This is identical to dd bs=4M if=<image file> of=<device>. Largely because it was written by Linux developers (initially). This program was initially used for installing usb images of 1G for installing Ubuntu on Netbook PC's. It is also useful for writing boot images for embedded dev platforms (beagleboards, pandaboards, raspberry pi, cyanogenmod, etc).

What you described is something more like gparted, where it will create partitions based on current image file ratios and new device sizes, then copy files and partitions over (unetbootin and Universal USB Installer do this, albeit with syslinux bootloader added in).

It takes a lot of dedicated time to develop something in Windows that would do this, especially given the amount of non-native filesystems it would need to support (ext[234], btrfs, xfs, reiserfs, etc). Windows has a hard enough time supporting their own filesystems.

Yes. You are right. In fact, I used gparted to solve my specific issue. But I happen to know enough Linux to be dangerous. I think you initial point is valid, ImageWriter has one goal, it does it well, so be it. Even if as an end-user... I suggest more. Even using Gparted, the MBR is not 100% right (functional for Raspberry Pi) but not pristine, when you do a image shrink after an ext4 resize (removing free space). And... last, you comment about Windows file systems? Very true, I have been in IT field some 35 years, if it has had a keyboard and CRT, likely I have used it. And, Windows still gives me pain now and then. :)

Bob Geddes (1-bob) said : #5

I adjust my partition size so its about 100Mb short of a full card. When Disk imager prompts me about the card being to small perhaps an option to continue and simply don't write any more when the card is full? This would allow me to restore RPi images.
How does dd cope with card to small for the file?

Tobin Davis (gruemaster) said : #6

iirc, dd will end ungracefully with an error. Some filesystems store backups of their core blocks at the end, which is another reason I don't do this currently (although their usage is very limited).

But this has nothing to do with partition sizes, as we are doing a binary device read/write. Not all 8G (or larger) memory modules are exactly the same number of bytes.

I will be looking into compressing the image sizes during read/write, and possibly adding auto-truncation to the reads, but that is overly complex. Won't happen in the near future as we are very time constrained with other projects/work/life.

Code fixes are always welcome. :P