1

First off, I'm running Rasbian with NOOBS.

I was following a tutorial on creating a new partition here: How do I create and mount a partition using the remainder of my SD card? And I started wondering why there's un-partitioned space on the sd card to begin with? Can I count on this always to be the case if I install Raspbian using NOOBS? Or should it be expected that the root partition takes up the entire remaining space? Thanks in advance.

Info for accepted answer

The reason I asked this question is because I'm updating a fleet of raspberry pi's remotely. Part of my update requires making a new partition on the disk. I am worried that the method I cited won't work for every SD card on my devices even though they are cloned from the same image. It worked for the SD card I'm testing on but how do I know there will be unpartitioned space on EVERY card?

The answer below tells me basically... it's not guaranteed and also resizing the root file system is impossible without unmounting it I believe. So basically I can either first see if there is unpartitioned space and apply the update, or get notified that a certain device can't be updated... shoot

Edit #2:

@crasic pointed out that it is possible to resize the root partition via the boot parameters in /boot/config.txt. See his link in his answer

7
  • 1
    I don't think I'd ever use NOOBS for a group of Rasperry Pi's. For one thing, I think that support would be much easier if you just installed Raspian on it.
    – NomadMaker
    Commented Aug 6, 2018 at 19:43
  • @NomadMaker In retrospect, I agree with you. When I first developed the code, I was using an SD card with NOOBS and once I got everything working, I just cloned that card. Oh well, hindsight is 20/20!
    – Will N
    Commented Aug 6, 2018 at 19:46
  • If I had to support this fleet, I would redo the disk and use Raspian. Remember that while developing is one thing, but support is forever! Or maybe it just seemed that way.
    – NomadMaker
    Commented Aug 6, 2018 at 19:50
  • Yes, perhaps next batch of SD cards I will redo the "master" image and drop NOOBS!
    – Will N
    Commented Aug 6, 2018 at 19:58
  • W.r.t to your last point. Resizing the partition can be done with alternate init= like is done with default rpi resize script. So the payload would modify /boot/config.txt trigger a restart that would execute the resize and restart again into the resized system.
    – crasic
    Commented Aug 6, 2018 at 20:00

1 Answer 1

1

By default, on first boot, for recent versions, Raspbian image expands the partition to fill the entire space. You can always trigger this resize manually as well using raspi-config as was indicated in an answer to the question you cited.

However, NOOBS changes this behavior by doing its own partitioning and perhaps not invoking this resize script. There is also an option to reserve a certain amount as a data partition directly from NOOBS. I do not believe it is default to leave unpartitioned space when doing a flat install with NOOBS.

If you need this space to always exist, you can either explicitly install with reserved space, manually partition, or modify the resize script to leave some room.

For details on how the resize-on-first-boot works, see my other answer.

There is space left because the OS image is shrunk to a minimal size to reduce the payload size and to support a wide range of SD card sizes (Otherwise you would be forced to use images for specific SD Card Sizes). The operating system provides tools to resize the partition, and has a boot script to automate the process.

3
  • Thanks @crasic . The reason why I ask is I'm remotely updating many raspberry pi's over the air and part of my update includes creating a new partition using the method I cited in my question. All the SD cards on the pi's were cloned from the same image and are the same size... do you think I can count on that method to work on all of them? Or did I get lucky that the one I tested it on had unpartitioned space? If I should post a new question let me know as I'm pretty new to the forum. Thanks again
    – Will N
    Commented Aug 6, 2018 at 19:23
  • 1
    If you are using identical images on identical SD cards, one could expect that the configuration is the same. However, since you did not consider/control for this when commissioning your fleet, there is still a chance that a few of them do not have this space. The tools used to expand a partition can be used to shrink one as well, so a reasonable approach would be to detect the presence of unpartitioned or unformated space and proceed only if detected. Collect the data from your fleet. If multiple units in your fleet fail, then you can distribute a payload that shrinks the root partition.
    – crasic
    Commented Aug 6, 2018 at 19:30
  • Great point thanks for your insight. I'll first check if there is room, if not, shrink the root partition (as 16 GB is way more than I need and I only need a little for my new one) and create my new one.
    – Will N
    Commented Aug 6, 2018 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.