4

I'm trying to duplicate a complete image with Raspbian and a custom video installation software multiple times; I bought eight identical Micro SD cards (SanDisk 32 GB). I made a master image, I copied it using dd. Now I'm trying to write that image to the other seven cards. I'm using Disk Image Writer on Gnome to do so. This went fine for the first six cards, but somehow the seventh is rejected, saying its capacity is too small (700 MB or so are missing). That one had been formatted before, so my hope is this is just a bug in the image writer. Because technically the cards should be 100% the same size.

What can I do? Can I force to write the image nevertheless? (The actual data only occupies like 2/3 of the 32 GB). Can I "shrink" the existing .img by throwing away some of the blank space? Can I reformat the card with a trick to look like a brand new one?


Edit: Here is what fdisk -l is giving me:

Disk raspi-player-0.1.0.img: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xee957452

Device                  Boot  Start      End  Sectors  Size Id Type
raspi-player-0.1.0.img1        8192   137215   129024   63M  c W95 FAT32 (LBA)
raspi-player-0.1.0.img2      137216 62333951 62196736 29.7G 83 Linux
  • 2
    this sounds helpful/related. – sir_ian Nov 23 '16 at 20:43
  • 1
    "Now I'm trying to write that image to the other seven cards. I'm using Disk Image Writer on Gnome to do so...my hope is this is just a bug in the image writer" -> Could be, but a point worth observing here is that if you have dd available, using some kind of more complicated "image writer" software is a waste of time for this task. Just use dd to write the image directly to the device, as is the recommended practice for burning Raspberry Pi images to SD cards on linux. – goldilocks Nov 23 '16 at 21:08
  • @goldilocks well, it's that this tool is actually much more simple - you right-click on the .img file, open the writer, select the SD card device, that's it. I'm looking into dd now – 0__ Nov 23 '16 at 21:20
  • Other than the fact you actually need a keyboard I'm having a hard time conceptualizing "much more simple" than dd but perhaps this is subjective... :/ – goldilocks Nov 23 '16 at 21:22
  • @goldilocks to give a another example: the Gnome tool tells me how much percent it has written and the ETA. I'm now staring at the terminal with zero information about how long the write will take, but I can already estimate that dd is more than twice as slow. – 0__ Nov 23 '16 at 22:34
1

The question linked to in the comment by @sir_ian provided the answer, linking in turn to this excellent blog: http://www.aoakley.com/articles/2015-10-09-resizing-sd-images.php - I followed all the steps described there, determining information with gparted and then using truncate.

  • 1
    That is a good tutorial - probably overkill to trim a little but from the end of an image. – Milliways Nov 24 '16 at 2:18
0

It is not the proper and right way to overcome your problem but you can give it a chance.

Use dd to copy template img file to your sd card. It should fail for the last bytes if the sd card is smaller than the image file.

But if you are lucky, that sd card will make your pi boot up.

0

There are no such things as "identical Micro SD cards", they often have minor differences in size, and can change as they wear.

The linked answer by goldilocks will let you manage images, but is a bit fiddly.

The EASY was to do this is to use the SD Copy program on Raspbian to copy a working image to a SD Card. This is actually faster than dd because it only copies fies (although the Pi may limit the throughput).

0

Here are two solutions in one article.

  1. If the original card is running you can resize the partition before making the .IMG file.
  2. If the original card is not available, the second solution is to use the IBEX File Size Changer program to resize the .IMG file to fit.

Here is an article that describes both processes.

http://www.raspberry-projects.com/pi/pi-operating-systems/resizing-partitions-disks

For me, the second method was my only choice. I had broken my original SD card but still had the image. I'm very glad it worked, because I had hours invested in configuring it just the way it needed to be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.