In this article, you will learn what's inside the Raspberry Pi's SD Card, how are image files created, copied and resized.
Table of Contents
- Image file contents
- Why do you only see boot partition when reading Raspberry Pi SD Card on Windows?
- Reading and writing .img file on SD Card
- Cloning Raspberry Pi SD Card and possible sizing issues
- How to shrink Raspberry Pi .img file?
1. Image file contents
Ever wondered what's inside a Raspberry Pi .img file?
A standalone .img file is a complete byte-by-byte image of the entire SD Card.
It typically includes two partitions:
Boot partition – A small FAT format boot partition, contains RPi firmware, a compiled Linux kernel and some configuration files.
Root partition – A large ext4 format partition which includes all the files directly used by Linux, including all the applications and your user’s home directory etc.
2. Why do you only see boot partition when reading Raspberry Pi SD Card on Windows?
Windows natively doesn't support reading ext4 partitions, which is why you only see the Boot partition which is in Windows compatible FAT format.
3. Reading and writing .img file on SD Card
Win32DiskImager software allows you to read or write Raspberry Pi image files on SD Card on Windows Operating system.
4. Cloning Raspberry Pi SD Card and Possible sizing issues
When you have a perfect working system, and you can replicate it by reading the state of SD Card to an image file and use that image to write multiple SD Cards. One possible issue you may face is the size of the image may be few sectors bigger to fit on an SD Card, this is due to different SD Card manufacturers don't follow the same standard for the number of sectors. In other words, an 8GB SD card from one manufacturer may be smaller in the number of sectors, when compared to an 8GB SD card from another manufacturer.
5. How to shrink Raspberry Pi .img file?
It is possible to resize a Raspberry .img to be smaller in size. The SD card usually has two partitions boot and root partition. The root partition which is larger in size and usually includes unused space in the tail. We can reduce the size of that unused space to make the image file smaller. I am working on a YouTube video explaining the process of shrinking the size of your Raspberry Pi image file.