How to expand the storage memory on the Yún

We are going to publish this sketch on the blog and we would like to make sure it works fine for everyone, so your feedback is highly appreciated.

It's much more a linux script than a sketch, but we thought that using a sketch would make it easier to use for everyone.

To give you an example, I used my 2Gigas micro sd card and told the sketch to split it in two halves.

This was the previous df -h / output

Filesystem                Size      Used Available Use% Mounted on
rootfs                    7.0M    356.0K      6.7M   5% /

And this is the output of df -h / /mnt/sda1 after running the sketch

Filesystem                Size      Used Available Use% Mounted on
rootfs                  861.8M     30.4M    788.2M   4% /
/dev/sda1              1022.0M     12.0K   1022.0M   0% /mnt/sda1

As you can see I went from 6.7M available to 788.2M and my /mnt/sd folder has 1G

If you encounter any error and would like to restore your yun to its previous state, all you need to do is to reboot it with the SD card UNplugged, then edit file /etc/config/fstab removing the following section

config mount
	option target '/overlay'
	option device '/dev/sda2'
	option fstype 'ext4'
	option enabled '1'
	option enabled_fsck '0'
	option options 'rw,sync,noatime,nodiratime'

and reboot once more