-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce the ability to limit rootfs size at first boot #69
Comments
E.g. for a 4 GiB filesystem: resize2fs /dev/mmcblk0p2 4G This is difficult? If you do not mind a question: Why do you need a dedicated data partition on the same drive? What is the advantage compared to a directory on the root filesystem? |
Is that resizing a live root partition? Fresh PiOS 32bit Lite
I think because it is still mounted (as it is boot).
This is for the OpenEnergymonitor emoncms system. Over the years it suffered with SD Cards failing despite various interventions put in place to buffer data etc. At worst it records multiple sensor data every 5s and writes it to file (and no, we are not going to use a different database engine 😄 ). Through experimentation, it was determined that using ext2 filesystem provided a more robust target for the data, so we started using that for a data partition. It has been successful and the number of failures is now very low. We used to use out own init
We distribute a pre-prepared SD Card, but also a script system for users to create their own setup. As far as I can see, it just needs the ability to specify an approximate Cheers |
Since this has come up a few times already, it seems like there's some demand for this feature. However, I don't want to change behaviour or add features until we have a test system in place to make sure non-default configurations work. Otherwise, it's easy to have a feature that breaks and we don't find out about it until somebody actually uses it months after an image release. So yes, but not right now. |
Right online shrinking does not work. The need for a different filesystem is indeed a good reason. We had this request at DietPi as well, hence I'm interested to year about cases. In theory, easy to implement here: https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/0a2e4c3/usr/lib/raspberrypi-sys-mods/firstboot#L45 The question is how to best offer the input:
Not sure how the test systems at RPi dev side look like, but if there are already tests done with giving rpi-imager/config file/flag first boot inputs, booting a (virtual or real) system and checking back whether the inputs have been successfully applied, checking the partition/filesystem size shouldn't be hard to implement? OOT: Interesting to see someone using emoncms. We had emonHub as software option in DietPi, but zero reported installs. And since we don't have the hardware to actually test the long untouched implementation, we removed it. Do you use emonHub or other software to read and store the sensor data? |
There aren't, so that's why I'm keen on getting something like that in place to make sure all configuration options are tested under all the headless setup mechanisms before doing anything else. |
Shall those tests run on physical hardware, or would an image "booted" as e.g. simple |
My suggestion (from our own experiences), is simply the ability to specify a rough size (say 6G) for the I'd suggest a check wrt the minimum allowed. Personally, something that could be set in a configuration file in the
emonHub is a key element of emoncms in many cases, especially those running on a Pi as it acts as both a software and hardware interface to push data to emoncms (and send on to other systems as well if required). We are in the process of updating the docs. |
In my experience, containers aren't quite the panacea some people claim they are. I have had plenty of cases where a simple But, if there's an easy stop-gap solution to the problem, that would be great. Is there a way to simulate different environments? For example, running as an init= script (so there is no systemd in that environment), running a systemd service the way rpi-imager does, through cmdline and "rebooting", or a full fledged environment where you can run an X session and start/stop services freely? The only way I can think of doing all that would be with qemu-system, which isn't trivial either. |
Couple of thoughts
|
Interestingly a user on the OEM forum has found a way round this. After flashing, before boot, create a partition on the SD Card which prevents the boot process filling the card with rootfs (not tried it myself). |
While this is being discussed, can I float the idea of (optionally?) rounding down common SD card sizes so that images can be easily cloned between cards from different manufacturers of roughly comparable sizes? In other words, define minimum sizes that could be given the labels 16GB, 32GB, 64GB, etc. and round down actual card sizes by a limited amount (up to 1%? 0,5GB?) when expanding the rootfs. |
If anyone comes here looking for a method to do this (prevent Perhaps simply offering an option to disable the resize operation is sufficient to satisfy those that want to do more with the card. |
Sounds good, but there's also another plan to deal with this scenario. Probably worth discussing offline.
I think for each person happy with the option, another 5 will ask why it doesn't create the extra partition, why the size, format and other options can't be configured, then why can't they add multiple extra partitions and it will keep going from there. |
A VM of course would be better. I tried to get qemu-system with the included RPi machine up to test Raspberry Pi images once, but mostly failed. It wasn't able to deal with the RPi kernel somehow, but can't remember details. Also you need to provide the kernel and dtb externally since it isn't able to load it from the FAT partition of the image, but would require a special layout for this. So I gave up on this and switched to systemd-nspawn with qemu-user.
I didn't understand all aspects of the question, but:
|
Yes, You can't please all of the people all of the time 😆 However, as a starting point, it would at least provide an option which currently doesn't exist at all. |
I currently do this by manually removing the With every new release of Raspberry Pi OS I worry that this hack will no longer be possible. Bookworm added the need to double-boot, for example. Having an option to set the partition size would be very welcome. |
raspberrypi-sys-mods/usr/lib/raspberrypi-sys-mods/firstboot
Line 28 in e44e454
Can the ability, via an option, be introduced to limit the size of
rootfs
at first boot?There can be advantages to having a smaller
rootfs
partition and a separate partition for data.Shrinking 'rootfs' is difficult, but starting with a smaller partition and increasing it is relatively simple.
The text was updated successfully, but these errors were encountered: