[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Disabling the automatic resizing



On Tue, 25 Oct 2022 at 00:09, Johnny de Villiers
<devilliersjohnny@gmail.com> wrote:

> Am working on a github repository to give a walkthrough on the setup of
> a device hosting a linux interface, this will extend all the way through
> docker and a web-server, however have yet to figure out  how to disable
> the automatic resizing on a Raspberry Pi using your pre-configured .img

> Have already written the scripts for the resize and docker components for
> Ubuntu and Raspbian, however the resizing of the root partition on the
> debian side... well I can't do it because the automatic resizing
> configures the "/" partition to consume all of the available space, the
> scripts that I have already written disable the resizing on the Raspbian
> and Ubuntu "init" sides as one can easily grow a "live" partition but the
> kernel does not like being made smaller.

> Any insight on how to disable the "grow part" on the debian side will be
> much appreciated!

Hello

I assume you are using one of the images found here[1]?

If that is correct, note this additional information (from [2]):

  Partitioning: The image ships as a 1500MB media, which means you can use
  it in any device of that size or greater. The first 300MB will be set
  aside as a boot partition. The image will resize to use all of the
  available space on the first boot — If you want it not to span the SD’s
  full size, after flashing it to your SD card, you can use fdisk to create
  a limiting dummy partition at the limit you want to set. After the first
  boot, just delete (or use!) that partition; the auto-resizer will not be
  run again.

The script that performs this operation is in the image:
  /scripts/local-bottom/rpi-resizerootfs

When I did this a while ago, I spent some time wrestling with this script
to persuade it to work. I found that this script has some additional
requirements not stated above:

1) There must be no additional partitions except the dummy partition, or
   else the script will hang at boot.

2) The dummy partition must include the last sector of the drive. Because
   if parted (in the script) reports any 'Free Space' at all after the
   dummy partition, the resize script will decide to do nothing.

3) The reason that "the auto-resizer will not be run again" is (if my
   memory is correct) that it does not exist outside of the initrd, which
   subsequently gets rebuilt to not include it. So if you want to read the
   script, you have to look into the initrd before booting the image. If
   you try to look for this script after booting, you will never find it.

[1] https://raspi.debian.net/tested-images/
[2] https://raspi.debian.net/defaults-and-settings/


Reply to: