os-helpers-fs: move logic to assert partition structure to helper file#3679
os-helpers-fs: move logic to assert partition structure to helper file#3679
Conversation
|
One or more environments require approval before deploying workflow runs. Maintainers, please inspect changes carefully for improper handling of secrets or other sensitive information. To approve pending deployments, submit an approved review, or a commented review with |
|
Website deployed to CF Pages, 👀 preview link https://0f30483c.balena-os.pages.dev |
Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
The memory check before a migration run was not taking into account that the tmp directory is now compressed ram. This change approximates the compressed size of the raw image which is the biggest in the calculation. The rest of the file sizes are left as is to provide some buffer for approximation failures and not to complicate the logic excessively. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
The logic to assert encrypted partitions was being implemented in a device specific way as part of cryptsetup - move it to common code so that this does not need to be re-implemented for every device type. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
…erts Use the shared helper functions to assert encrypted partitions. Note that the new functions have introduced some refactoring so that they can be used in the general case. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
This is used from the initramfs of flasher devices to erase the disk of secrets. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
Move the generic dmcrypt partition assertion logic. This is slightly different as paritions do not contain meta-data that can identify the encrypted partitions so dmsetup is used after the partition is mounted. Change-type: patch Signed-off-by: Alex Gonzalez <alexg@balena.io>
| # 0: Success | ||
| # 1: Failure | ||
| # | ||
| estimate_size_in_zram() { |
There was a problem hiding this comment.
Hi @alexgg, I'm wondering why what was a one liner, became this more complex function?
It's seems that this function measures the size that a file is going to take in zram by compressing the file manually and counting the blocks.
Was there a bug with the du command?
Why is it always zram compressed now? vs never compressed (du -cb)?
Is it that we were we were actually requiring the raw image size, when we actually needed the compressed one?
If not what was the problem and how was it solved?
I haven't yet really gotten into HUP and updating the OS and the associated complexity sorry if I'm lacking a bit of context.
Move the generic dmcrypt partition assertion logic. This is slightly different as paritions do not contain meta-data that can identify the encrypted partitions so dmsetup is used after the partition is mounted.
Change-type: patch
Contributor checklist
Change-typepresent on at least one commitSigned-off-byis presentReviewer Guidelines