[HOWTO] Resize Your Linux Partition LIVE

Moderators: odroid, meveric, mdrjr

[HOWTO] Resize Your Linux Partition LIVE

Unread postby mdrjr » Mon Dec 09, 2013 5:48 am

This guide will teach you how to properly resize your Linux install partition without anything but the OS booted on the ODROID Board.

This guide works for eMMC or SDCard.
Make sure that you have only the eMMC or SD connected at this time.

Download the script attached on this thread

and type:
Code: Select all
chmod +x resize.sh
sudo ./resize.sh


You'll see the following output:
Code: Select all
root@odroid:~# sudo ./resize.sh
Found the start point of mmcblk0p2: 266240
Ok, Partition resized, please reboot now
Once the reboot is completed please run this script again


reboot the board now, just type sudo reboot

Once the boot is done, run the script again!
Code: Select all
root@odroid:~# sudo ./resize.sh
Activating the new size
resize2fs 1.42.5 (29-Jul-2012)
Done!
Enjoy your new space!


You are done now, your / partition is using the entire space of the disk :)
Attachments
resize.sh
Resize v1
(600 Bytes) Downloaded 10561 times
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE (X/X2/U2)

Unread postby memeka » Mon Dec 09, 2013 5:59 am

Finally :) I've been doing this forever.
btw, it works with the 3.0 kernel, and for the XU as well (as long as you have kernel support, and there are big chances there is kernel support for ext3 and ext4).
User avatar
memeka
 
Posts: 3894
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: [HOWTO] Resize Your Linux Partition LIVE (X/X2/U2)

Unread postby mdrjr » Mon Dec 09, 2013 6:06 am

memeka wrote:Finally :) I've been doing this forever.
btw, it works with the 3.0 kernel, and for the XU as well (as long as you have kernel support, and there are big chances there is kernel support for ext3 and ext4).


And why you never posted here explaining how to use?

I've been doing this since the first boot of 3.8 on my -X.

Edit: Yes, it works on XU too. So.. all odroid's should be covered now.
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby memeka » Mon Dec 09, 2013 7:10 am

We were talking about it here: viewtopic.php?f=9&t=1239&start=40#p10406 :)
I was complaining to neagix that switching to ext2 for rootfs you cannot to this, since only ext3 and ext4 were supported in the kernel :)
User avatar
memeka
 
Posts: 3894
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby osterluk » Mon Dec 09, 2013 11:18 am

Nice. This will help a lot of people.
Thanks
osterluk
 
Posts: 311
Joined: Sun Feb 24, 2013 2:07 am
languages_spoken: English
ODROIDs: Odroid-U2

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby wmseward » Thu Dec 26, 2013 7:37 am

Nice simple script. Code review is easy!

Now I want to write a script.

Thanx!
wmseward
 
Posts: 3
Joined: Wed Dec 25, 2013 11:41 am
languages_spoken: english
ODROIDs: Soon to get U3(s)!

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby TSC » Fri Jun 13, 2014 3:30 am

I get:
Code: Select all
open: No such file or directory while opening /dev/mmcblk0p2
.

Any idea how to resolver this? I have Lubuntu 13.10 CodeMonkey U2 image installed in the eMMC through win32diskimager. Image runs good in U3 and I can open the content in Windows. But no luck on mounting this image in Ubuntu 13.10 (installed in my laptop). Need the partition resized since I have a 16gb eMMC and can only use 8GB of the image above.

Running dmesg on the cmd line gives me:

Code: Select all
[  604.675367] mmc0: BKOPS_EN bit is not set
[  604.678521] mmc0: error -22 whilst initialising MMC card


gparted doesn't give me any partition at all besides the one /dev/sda1, /dev/sdb/ and /dev/sdc/.

Thank you! Any help would be great!

Best regards
Last edited by TSC on Fri Jun 13, 2014 3:40 am, edited 1 time in total.
TSC
 
Posts: 41
Joined: Sat May 11, 2013 9:51 pm
languages_spoken: english, portuguese
ODROIDs: ODROID-X2 / U3

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby mdrjr » Fri Jun 13, 2014 3:33 am

Do you have a microsd at the same time ? If so, remove it.. resize and it will work..
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby TSC » Fri Jun 13, 2014 6:38 am

mdrjr wrote:Do you have a microsd at the same time ? If so, remove it.. resize and it will work..


No microsd inserted. Just the emmc connected to the sd card reader of the laptop through the emmc-to-usd adaptor. This adaptor is also inserted in a usd-to-sd adaptor.
TSC
 
Posts: 41
Joined: Sat May 11, 2013 9:51 pm
languages_spoken: english, portuguese
ODROIDs: ODROID-X2 / U3

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby mdrjr » Fri Jun 13, 2014 6:43 am

Ugh. This script is made to be executed on the board with the OS running not on your PC
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby TSC » Fri Jun 13, 2014 6:50 am

mdrjr wrote:Ugh. This script is made to be executed on the board with the OS running not on your PC

Lol a sério? Desculpa nao tinha percebido! Vou experimentar e depois aviso. Saudações de Portugal ;)
TSC
 
Posts: 41
Joined: Sat May 11, 2013 9:51 pm
languages_spoken: english, portuguese
ODROIDs: ODROID-X2 / U3

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby labsin » Thu Feb 19, 2015 8:02 am

This script is a bit dangerous. I have a setup with only one partition so it doesn't find the start byte, so the it just enters 0 when asked for the start byte.
It needs some checks etc.
Might be best to just post the steps.
labsin
 
Posts: 5
Joined: Thu Feb 19, 2015 7:50 am
languages_spoken: english
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby rakekniven » Sat Feb 21, 2015 3:22 am

My C1 does not want to resize.
Took the image from 5th of feb and wrote it on my 32 GB SD card using the Windows tool.
Device is booting up fine and everything is good so far.

Code: Select all
:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2  4.3G  4.0G  184M  96% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            420M  4.0K  420M   1% /dev
tmpfs           425M  4.0K  425M   1% /tmp
tmpfs            85M  2.6M   83M   3% /run
none            5.0M     0  5.0M   0% /run/lock
none            425M   76K  425M   1% /run/shm
none            100M   24K  100M   1% /run/user
/dev/mmcblk0p1  129M  7.2M  122M   6% /media/boot


So I took the script "resize.sh" and started it.
Output
Code: Select all
:~# ./resize.sh
Found the start point of mmcblk0p2: 266240
Ok, Partition resized, please reboot now
Once the reboot is completed please run this script again

So I rebooted it and run it again.

Output:
Code: Select all
:~$ ./resize.sh
Activating the new size
resize2fs 1.42.9 (4-Feb-2014)
resize2fs: No space left on device While checking for on-line resizing support
Done!
Enjoy your new space!


fstab info:
Code: Select all
:~$ more /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM

UUID=e139ce78-9841-40fe-8823-96a304a09859   /   ext4   errors=remount-ro,noatime,nodiratime      0 1
UUID=6E35-5356   /media/boot   vfat   defaults,rw,owner,flush,umask=000   0 0
tmpfs      /tmp   tmpfs   nodev,nosuid,mode=1777         0 0


Hmmh, have not found any useful hints.

Anyone?
rakekniven
 
Posts: 3
Joined: Fri Feb 20, 2015 4:49 pm
languages_spoken: english, german
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby mdrjr » Sat Feb 21, 2015 3:26 am

Use ODROID Utility to do that.
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby rakekniven » Sat Feb 21, 2015 8:54 pm

Done that in the meantime. Works pretty well.
Thx.
rakekniven
 
Posts: 3
Joined: Fri Feb 20, 2015 4:49 pm
languages_spoken: english, german
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby labsin » Sun Feb 22, 2015 4:51 am

loboris also has a nice fs_resize script in his Ubuntu/Debian distro's that deals with 1 partition, does some echo'ing and adds a init script for resize2fs on reboot.

I attached it here. But it's not mine, it's from http://forum.odroid.com/viewtopic.php?f=112&t=8075
Attachments
fs_resize.sh
(2.3 KiB) Downloaded 587 times
labsin
 
Posts: 5
Joined: Thu Feb 19, 2015 7:50 am
languages_spoken: english
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby weyb » Fri Mar 27, 2015 8:18 pm

mdrjr wrote:Use ODROID Utility to do that.


for the newbies like me : it's on the Ubuntu desktop !
weyb
 
Posts: 30
Joined: Fri Mar 20, 2015 9:28 pm
Location: Grasse (06 France)
languages_spoken: english
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby atodea » Sat May 30, 2015 8:22 pm

Thank you.
It works like a charm!
atodea
 
Posts: 3
Joined: Sat Mar 08, 2014 6:30 am
languages_spoken: english

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Cerin » Mon Jun 01, 2015 11:26 am

I used the "Odroid Utility" to resize the partition on my C1. It does nothing. Running `df -H` still shows that /dev/mmcblk0p2 is still only 4.6G even though I'm using a 32GB card.

How do you expand the root partition on a C1?
Cerin
 
Posts: 2
Joined: Mon Jun 01, 2015 10:32 am
languages_spoken: english
ODROIDs: C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby mdrjr » Mon Jun 01, 2015 11:35 am

Cerin wrote:I used the "Odroid Utility" to resize the partition on my C1. It does nothing. Running `df -H` still shows that /dev/mmcblk0p2 is still only 4.6G even though I'm using a 32GB card.

How do you expand the root partition on a C1?


Start by posting on the correct place and attaching the LOG on /root.

Did you rebooted after the resize?
mdrjr
Site Admin
 
Posts: 11665
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby ceVoIX » Mon Aug 31, 2015 7:27 pm

Hi,
I am a linux beginner, in which folder i have to grab the resize.sh file?
ceVoIX
 
Posts: 7
Joined: Tue Aug 25, 2015 10:23 pm
languages_spoken: german, english
ODROIDs: Odroid C1+

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby meveric » Mon Aug 31, 2015 8:17 pm

doesn't matter as long as you start it as root (or with sudo)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 8768
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby inf3rno » Mon Feb 15, 2016 10:48 am

I would rather use gparted on my PC with Fedora 23 and a micro SD - USB adapter. Is there anything special in the partition resize process which requires this script?
inf3rno
 
Posts: 37
Joined: Fri Feb 05, 2016 7:17 pm
languages_spoken: english
ODROIDs: Odroid XU4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby meveric » Mon Feb 15, 2016 2:44 pm

nope.. using gparted works just fine
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 8768
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Mikitz » Sat Jun 24, 2017 5:37 pm

mdrjr wrote:Ugh. This script is made to be executed on the board with the OS running not on your PC


This is an easy fix. Simply run the following from a terminal.
Code: Select all
wget -O resize.sh https://forum.odroid.com/download/file.php?id=502


Then, all of the commands in the OP will function properly.

Piece of cake, it is :)
Mikitz
 
Posts: 13
Joined: Mon Jul 04, 2016 9:50 pm
languages_spoken: english, 한국어, 中文
ODROIDs: XU4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Max Headroom » Wed Sep 20, 2017 5:11 am

Hello, this is what I have done and these are the result. It ain't working! Also, for those claiming that resize is on the desktop, please be more specific. Where? Thanks in advance.
odroid@odroid:~$ wget -o resize.sh download/file.php?id=502
odroid@odroid:~$ chmod +x resize.sh
odroid@odroid:~$ sudo ./resize.sh
[sudo] password for odroid:
./resize.sh: 1: ./resize.sh: --2017-09-19: not found
./resize.sh: 2: ./resize.sh: Syntax error: "(" unexpected
odroid@odroid:~$ wget -o resize.sh download/file.php?id=502
odroid@odroid:~$ chmod +x resize.sh
odroid@odroid:~$ sudo ./resize.sh
[sudo] password for odroid:
./resize.sh: 1: ./resize.sh: --2017-09-19: not found
./resize.sh: 2: ./resize.sh: Syntax error: "(" unexpected
Max Headroom
 
Posts: 14
Joined: Thu Sep 14, 2017 8:33 am
languages_spoken: english
ODROIDs: XU-4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby odroid » Wed Sep 20, 2017 7:51 am

Can you check the downloaded file contents? I think you should use "-O" instead of "-o".
Code: Select all
#!/bin/bash

fdisk_first() {
      p2_start=`fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{print $2}'`
      echo "Found the start point of mmcblk0p2: $p2_start"
      fdisk /dev/mmcblk0 << __EOF__ >> /dev/null
d
2
n
p
2
$p2_start

p
w
__EOF__

      sync
      touch /root/.resize
      echo "Ok, Partition resized, please reboot now"
      echo "Once the reboot is completed please run this script again"
}

resize_fs() {
   echo "Activating the new size"
   resize2fs /dev/mmcblk0p2 >> /dev/null
   echo "Done!"
   echo "Enjoy your new space!"
   rm -rf /root/.resize
}


if [ -f /root/.resize ]; then
   resize_fs
else
   fdisk_first
fi


BTW, our latest Ubuntu images are resizing the rootfs automatically in the first boot process.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Max Headroom » Wed Sep 20, 2017 11:20 am

Hello,
First, Thanks for sending a copy of the script with your message. Next, I am using a 32GB micro sd card. When I look under System and 'Display disks' the first disk is labeled mmcblk1p1 is 134MB total and 119MB free. The Second is: mmcblk1p2 and 32GB 26GB free. Should I replace the mmcblk0 in the script with mmcblk1p1 in order to get the script to work?
How should I run this? double click and 'run in terminal', RUN, or? Finally I wondered if that character was zero, small letter o or capital O I found it difficult to determine which.
P.S. I managed to get a download of the script. Every way I try to run it I receive the same message as listed in my previous query. I obtained the image two days ago from U.S. East website. I tried U.S. West using a 32 bit Win 7 system. What I got was a looooong page full of ASCII characters that froze until 1.3 GB download was done. I did not get a 'file'. Thanks again!
Max Headroom
 
Posts: 14
Joined: Thu Sep 14, 2017 8:33 am
languages_spoken: english
ODROIDs: XU-4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby odroid » Wed Sep 20, 2017 12:00 pm

Try "cat resize.sh" to check the script.
And run it with "sudo ./resize.sh".

BTW, which OS image did you flash to your 32GB sd card?
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Max Headroom » Thu Sep 21, 2017 12:51 am

Hello,
I flashed: ubuntu-16.04.3-4.9-mate-odroid-xu4-20170824.img.xz 2017-08-25 12:35 1.2G off the mirror site. Again, due to the anomalous download from the main site. I am using Windows 7 32 bit on a Dell machine. Also, because it took days to troubleshoot and determine the main site yielded anomalus downloads. I ordered the 16GB pre-flashed-SD from Odroid. I received it yesterday. It has two partitions on it, a 134MB and a 16GB. It is just like the 32GB SD I flashed except its capacity is smaller. In each one the 'reported name of each partition is: mmcblk1p1 and mmcblk1p2 respectively.
Max Headroom
 
Posts: 14
Joined: Thu Sep 14, 2017 8:33 am
languages_spoken: english
ODROIDs: XU-4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby odroid » Thu Sep 21, 2017 8:43 am

Those new images has a feature of autoresizing in the first booting process.
Check "df -H" output on the command line.
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby Max Headroom » Fri Sep 22, 2017 3:24 pm

Hello Odroid,
Either these features exist on the SD Drive from the store as well as the 32GB SD card I flashed or they do not. I believe that I have Adequately explained that Linux is reporting that I have two partitions and that they are designated /dev/mmcblk1p1 and /dev/mmcblk1p2. I would point out that since this is what Linux-mate is reporting and all indications are that this is true, then I have two partitions. IF these freatures you are alluding to exist... they are failing or non-existant. So, I am telling you I have two partitions if I am supposed to have a solitary partition, something is failing. I guess I will go to the web, maybe someone else has written a script to repartition an existing SD card while preserving the data. Thanks for your attention.
Max Headroom
 
Posts: 14
Joined: Thu Sep 14, 2017 8:33 am
languages_spoken: english
ODROIDs: XU-4

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby odroid » Fri Sep 22, 2017 3:29 pm

Our Ubuntu image has two partitions. Boot(VFAT) and rootfs(EXT4) partitions.
https://wiki.odroid.com/odroid-xu4/soft ... tion_table
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby dirtyrobinson » Sat Dec 23, 2017 3:12 pm

I ran this script to resize my 16gb SD card but now it won't boot nor is it recognized by any of my other boards. Windows shows that the partition was expanded at least but I can't access the linux partition to recover data. I think it screwed up the boot.ini getting the following errors on boot:

mmcblk0: r/w command failed, status = 0x80000b00
end_request: I/O error, dev mmcblk0, sector 31225848
Buffer I/O error on device mmcblk0, logical block 3903231
mmc_blk_reset 938 error md->reset_done:1 and type:1

emmc: mmc_rescan_try_freq: trying to init card at 300000 Hz

update: I am able to access the partition using Ext2Explore to recover data and/or edit files, I still wanna repair this so any help is appreciated!
dirtyrobinson
 
Posts: 36
Joined: Sun Jan 19, 2014 8:49 am
languages_spoken: english
ODROIDs: Odroid U3 & C1

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby odroid » Sat Dec 23, 2017 5:30 pm

Our official images automatically resize the rootfs in the first boot process.
Which OS image did you use?
User avatar
odroid
Site Admin
 
Posts: 27984
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: [HOWTO] Resize Your Linux Partition LIVE

Unread postby dirtyrobinson » Sat Dec 23, 2017 5:41 pm

I don't remember which image exactly, I don't think it was an official image. My image is just named as C2-Debian. This specific board has been set up for over a year now so I would have to dig through some notes to see if I made a note of which image it was.

I just realized today that I'm only using half the storage so thought why not resize it quick... fail
dirtyrobinson
 
Posts: 36
Joined: Sun Jan 19, 2014 8:49 am
languages_spoken: english
ODROIDs: Odroid U3 & C1


Return to Ubuntu (All Linux'es)

Who is online

Users browsing this forum: No registered users and 2 guests