5
  1. I have a 8gb sd card with raspian image. Also I had expanded filesystem using sudo raspi-config.
  2. After that I had crated image using win32diskimager. Image size is around 8,068,792,320 bytes . However when I try to burn same image back to same sd card, win32imager shows error that not enough space.
  3. Strange thing is sd card is same, same image is read , but when I write back it fails.
3

Each and every SD card, even Hard Drive always has a different amount of usable sectors.

This is a common issue when cloning your expanded Raspbian and trying to rewrite it to another SD card, as it most probably has less usable sectors.

The same may apply to the the exact same card, due to different sector alignments caused by partition aligning and various other little things. Usually these get overcompensated so the actual image is slightly larger than the SD card that way.

1)

One way to overcome this, is to setup your image from scratch without expanding the file system to 8GB. Dump the image (which will be 4GB), then write it to another 8GB card. Boot the new card up and only then expand the File System.

2)

You can reduce the file system on the existing image, using resize2fs by 100MB for example. The problem is you only resized the file system but the image is still the original size. You would just need to redo the DD and limit the size by 99MB (so there will be roughly 1MB of unused space in the image), not to hit the newly resized file system. This will be sure it will fit all next 8GB sized cards.

I find option 1 easier and faster to be honest but we had to learn the hard way.

3
  • 1
    Hi Ppumkin, do I understand u correctly: ->Starting with 8gb sd card, raspbian image & win32imagewriter ->Write raspbian in 8gb card using win32. Now boot raspberry pi ->Now read back image using win32. -> Now again write back image in same 8gb card ->Now expand File system Nov 25 '15 at 15:45
  • Yea.. thats correct. If the purpose is to first install some stuff on the SD card, do updates and stuff. Then make an image for use later. So next time you can just write this 4GB image that has your updates and other software maybe. Then if you break something or just want to restart, burn the 4GB updated version you made. Then just do a expand on first boot after burning "your image" - I do that now because I like to restart very often, but hate doing updates every time.
    – Piotr Kula
    Nov 25 '15 at 15:55
  • But if you run out of space at 4GB, just do a manual resize to 7gb. That will be safe to dump, and reuse as a backup. Then on restore to the expand to full size to get the remaining 1GB without this problem.
    – Piotr Kula
    Nov 25 '15 at 16:00
1

If you have access to a Linux system check out mvp's answer.

I followed this answer as I had the same issue as you. First you will create a compressed image of the SD card. Then you will write this image to the SD card. This will fail as the image is too large for the SD card however the data that cannot be written to the SD card is empty space so everything will work as before.

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.