Open
Conversation
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
Contributor
jasvinderkhurana
left a comment
There was a problem hiding this comment.
@vmayoral , I have a script which I use to increase the partition size, and it does not require any booting or manual inputs, can you pleas evaluate below script as well and let me know your opinion which one is more suitable
#!/usr/bin/env bash
# Short-Description: Resize the root filesystem to fill partition
ROOT_PART=$(mount | sed -n 's|^\(.*\) on / .*|\1|p')
ROOT_DEV=$(echo $ROOT_PART | cut -c 1-12)
PART_NUM=$(echo -n $ROOT_PART | tail -c 1)
MOUNTED=$(mount | sed -n '/^\(.*\)'$PART_NUM' on \/[a-zA-Z0-9].*ext/p')
do_expand_rootfs()
{
local target=$1
local part_num=$2
if [ -n "${MOUNTED}" ]; then
echo -e "yes\n100%" | parted ${target} ---pretend-input-tty resizepart ${part_num} > /dev/null 2>&1
else
parted ${target} resizepart ${part_num} 100% > /dev/null 2>&1
fi
}
ext4_resize()
{
if [ "$ROOT_DEV" != "/dev/mmcblk1" -a "$ROOT_DEV" != "/dev/mmcblk0" ]; then
echo "$ROOT_DEV is not an emmc or sd card. Don't know how to expand"
exit
fi
do_expand_rootfs $ROOT_DEV $PART_NUM && resize2fs $ROOT_PART > /dev/null 2>&1
}
ext4_resize
Contributor
|
I got another simple way to resize the partition, please check if that is more useful and we can publish that in "How-to" section: $ sudo parted /dev/mmcblk1 resizepart 2 $ sudo resize2fs /dev/mmcblk1p2 |
Contributor
Author
|
Looks good to me 👍! Feel free to add it.
El El sáb, 22 ene 2022 a las 20:37, jasvinderkhurana <
***@***.***> escribió:
… @vmayoral <https://github.com/vmayoral> ,
I got another simple way to resize the partition, please check if that is
more useful and we can publish that in "How-to" section:
$ *sudo parted /dev/mmcblk1 resizepart 2*
Warning: Partition /dev/mmcblk1p2 is being used. Are you sure you want to continue? Yes/No? yes
End? [6442MB]? 100%
Information: You may need to update /etc/fstab.
$ *sudo resize2fs /dev/mmcblk1p2*
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 4
The filesystem on /dev/mmcblk1p2 is now 7267455 (4k) blocks long.
—
Reply to this email directly, view it on GitHub
<#32 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPYDSBUYWPTTQZGMQEU5DUXMBP3ANCNFSM5JQSKMGQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Víctor Mayoral Vilches v.mayoralv@gmail.com