What happens if the SD card is larger than the img file

Asked by George Brooke

Hi,
I am just starting out with a Raspberry pi. It has a 16GB SD card. I want to install a Debian and Domoticz system from an img file. I know that the SD card for this image must be at least 4GB, but I am concerned that if I install on my 16GB card then 12GB will be "lost".
Does Image Write deal with the extra space sensibly? If so, what doe it actually do?

Thanks for the help

George

Question information

Language:
English Edit question
Status:
Solved
For:
Image Writer Edit question
Assignee:
No assignee Edit question
Solved by:
George Brooke
Solved:
Last query:
Last reply:
Revision history for this message
Jeff B (skydiver38) said :
#1

ImageWriter writes whatever image you give it to the media that you give it. If you give it an image file for a 4GB file system, then you'll end up with a 4GB file system on the device. If you give it an image file for a 16GB file system, then you'll end up with a 16GB file system on the device.

ImageWriter doesn't do any partitioning, or optimization, or anything along those lines. If you give it a 4GB file system image file and a 16GB device, then the device will be 4GB until you re-format it.

Hope this helps.

Revision history for this message
George Brooke (george-m-brooke) said :
#2

Hi,

yes it helps .. and it is exactly what I was afraid of. This seems to be a point which is missed by those proposing the use of ImageWriter. They talk about a minimum size of SD card but do not mention the consequences of using a larger card.. all that space wasted. So, I don't think I am going to go this route, unless there is way that after writing the image file I can then reclaim the lost space without losing the content of the SD card. Any ideas on that ?

Revision history for this message
George Brooke (george-m-brooke) said :
#3

Hi,

I think I have answered my own question. See below, for using sudo raspi-config:

sudo raspi-config
   The sudo (do as superuser) is necessary because you will be changing files that you as user pi do not own.

    expand_rootfs - Expand root partition to fill SD card[edit]

    The usual distribution images are 2 GB. When you copy the image to a larger SD card you have a portion of that card unused. This option expands the initial image to expand to fill the rest of the SD card, giving you more space. You need to reboot the Raspberry Pi to make this available. THERE IS NO CONFIRMATION - SELECTING THE OPTION EXPANDS THE PARTITION.

If the above is correct then all I do is build the image and then expand with this command. No reformatting and information is apparently preserved.

Revision history for this message
Jeff B (skydiver38) said :
#4

good to know. thanks for sharing that info.

Revision history for this message
Tobin Davis (gruemaster) said :
#5

This sounds similar to how Ubuntu shipped their preinstalled arm images. The image was 1G, and would automagically expand the root filesystem to fill the SD card on first boot. This method is much easier than either creating preinstalled images for every size SD card (as there is no standard - 8G doesn't always equal 8G on every device) or writing a utility (like Win32DiskImager) to be able to auto-expand a filesystem on write.

Revision history for this message
Tobin Davis (gruemaster) said :
#6

Tobin Davis suggests this article as an answer to your question:
FAQ #1927: “My Xgb pen drive was reduced to Ygb”.

Revision history for this message
George Brooke (george-m-brooke) said :
#7

I agree.... it is much easier than making versions for different card sizes.
I guess my real gripe is that there appears to be an assumption that we all know about the magic of raspi-config. It would not take much to make this a standard, documented, step in the installation procedure and avoid this discussion completely.
Still, we seem to be over this little problem, now for the next