Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: Zaxter on February 11, 2015, 11:36:43 AM

Title: Unable to shrink root fs
Post by: Zaxter on February 11, 2015, 11:36:43 AM
I'm using Igor's ubuntu trusty image with kernel 3.4.105 (http://www.igorpecovnik.com/2014/11/18/olimex-lime-debian-sd-image/ (http://www.igorpecovnik.com/2014/11/18/olimex-lime-debian-sd-image/)). This image auto-resizes the rootfs to occupy the complete SD card, on first login.

I have installed custom software onto this SD card, and now I want to clone it. But, I need to shrink the rootfs to 2GB before doing so.

Here's what I did:


However, the board doesn't boot up after this.

What am I doing wrong? I'm a newbie, please help.
Title: Re: Unable to shrink root fs
Post by: JohnS on February 11, 2015, 11:47:10 AM
That looks to reduce the size for the fs but isn't re-making the fs i.e. moving data and its inode etc info, so corrupts it.

I'd use a loopback device of the size you want on a PC, copy data across file-by-file, remake the SD card and copy data back.

John
Title: Re: Unable to shrink root fs
Post by: Zaxter on February 11, 2015, 12:02:42 PM
Thanks for your reply John. I will try as you have said.
For curiosity's sake, how is it that the above method works with raspberry pi?(http://elinux.org/RPi_Resize_Flash_Partitions#Manually_resizing_the_SD_card_on_Raspberry_Pi (http://elinux.org/RPi_Resize_Flash_Partitions#Manually_resizing_the_SD_card_on_Raspberry_Pi))
Title: Re: Unable to shrink root fs
Post by: JohnS on February 11, 2015, 12:48:49 PM
I don't know if it works for shrinking.  It may, for a smallish change, but at some point it definitely won't.  There again I expect hardly anyone uses it for shrinking.

BTW, I didn't see where you ran resize2fs - did you try it?

John
Title: Re: Unable to shrink root fs
Post by: Zaxter on February 11, 2015, 02:04:24 PM
I didn't run resize2fs. I thought that was supposed to be done after the reboot. (But my board didn't reboot at all.  :( )

Do you suggest running resize2fs before rebooting?
Title: Re: Unable to shrink root fs
Post by: Zaxter on February 11, 2015, 02:17:22 PM
I tried resize2fs, but this still doesn't work:

root@micro:~# resize2fs /dev/mmcblk0p1
resize2fs 1.42.5 (29-Jul-2012)
The filesystem is already 1940224 blocks long.  Nothing to do!



The board keeps rebooting continuously.
Title: Re: Unable to shrink root fs
Post by: JohnS on February 11, 2015, 03:22:29 PM
You're not doing it the way that link you posted does are you?

You'll have already corrupted things so will have to start over.

John