0

I'd like to limit the amount of space used in the SD card because after flashing the RPi I will migrate the boot to an SDD, and the SDD has limited space - so I need to restrict the amount that will be cloned later.

However, although I have created partitions in the SD card, whenever it installs a system, it uses the entire SD card. I can't find a way to direct it to a single partition only.

Thx!

42piratas
  • 101
  • 3

2 Answers2

1

RPi imager creates at least two partitions. A small boot partition formatted with FAT and a large Linux partition formatted with ext4.

The Linux partition is normally expanded after first boot to use all space remaining on the SD card. I thought that could be disabled by running raspi-config at first boot.

If you can't stop expansion then just use a partition shrinker such as GParted.

joan
  • 71,852
  • 5
  • 76
  • 108
1

Any imaging tool overwrites the partition table and erases any partition or structure which may exist - although it will leave unallocated space.

The partition is expanded on first boot by the Pi itself not by the imager.

The exact mechanism used by Raspberry Pi Ltd. has changed in the last couple of years and I don't remember the details BUT if you examine the cmdline.txt file before booting the Pi you will see at the end a script that is run once and later deleted.

You could delete this BUT the current first boot also creates the user (it probably modifies pi) so the image may be unusable (until the very small root partition is expanded there is insufficient space to run effectively).

You could examine /usr/lib/raspberrypi-sys-mods/firstboot and modify it but it is likely to be easier to shrink the newly created root partition, which is simple on any Linux system.

Milliways
  • 62,573
  • 32
  • 113
  • 225