Skip to content
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

Improve fs-resize, fix delay and simplify #2993

Merged
merged 3 commits into from
Nov 4, 2018

Conversation

mglae
Copy link
Contributor

@mglae mglae commented Sep 21, 2018

fs-resize running at early boot time may need minutes to complete because the kernel RNG is not initialized.

When parted and sgdisk call uuid_generate(), util-linux libuuid implementation use a blocking getrandom() syscall. It waits until the kernel crng has collected enough entropy. Having a SSD, no network, no user input and no HW RNG this can take a long time. The behavior explains the delay seen in #2957.

This is fixed in util-linux 2.32:

commit a9cf659e0508c1f56813a7d74c64f67bbc962538
Author: Carlo Caione <carlo@endlessm.com>
Date:   Mon Mar 19 10:31:07 2018 +0000

    lib/randutils: Do not block on getrandom()
    
    In Endless we have hit a problem when using 'sfdisk' on the really first
    boot to automatically expand the rootfs partition. On this platform
    'sfdisk' is blocking on getrandom() because not enough random bytes are
    available. This is an ARM platform without a hwrng.
    
    We fix this passing GRND_NONBLOCK to getrandom(). 'sfdisk' will use the
    best entropy it has available and fallback only as necessary.
    
    Signed-off-by: Carlo Caione <carlo@endlessm.com>

Using parted's 3.2 'resizepart' command removes the partition recreation hack.

fi

StartProgress spinner "Resizing partition... " "parted -s -m $DISK resizepart 2 100% &>/dev/null"
StartProgress spinner "Checking /storage... " "e2fsck -f -p $PART &>/dev/null"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well make this one Checking file system... " to be consistent?

Cosmetic nit: Would it be possible to vertically align the spinner outputs (add extra spaces after ... where necessary)?

Thanks for this, certainly is simplified, but will need thorough testing! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better now :)

@mglae
Copy link
Contributor Author

mglae commented Sep 22, 2018

I've tested on generic only. To look for anomalies better use the fs-resize debug version.

@MilhouseVH
Copy link
Contributor

After #3035 this now requires a rebase.

@MilhouseVH MilhouseVH merged commit 1f7d6fe into LibreELEC:master Nov 4, 2018
@mglae mglae deleted the le9_fsresize branch November 5, 2018 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants