-
Notifications
You must be signed in to change notification settings - Fork 18
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
Document how to resize partition #32
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
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
|
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:
***@***.***>
|
Signed-off-by: Víctor Mayoral Vilches v.mayoralv@gmail.com