Arduino Forum

Products => Arduino Yún => Topic started by: Federico_Vanzati on Apr 29, 2014, 04:21 pm

Title: How to expand the storage memory on the Yún
Post by: Federico_Vanzati on Apr 29, 2014, 04:21 pm
You might have noticed that on the Linux side of the Yún the amount of available storage memory of the onboard flash memory is limited. Installing additional software packages you can run out of space soon. You can manually install software packages on an external SD card but it's tricky...and it's manual. OpenWRT gives you the possibility to move the root file system to an external storage as large as desired.

We wrote a sketch that is able through the Bridge library to format the SD card, prepare the partitions and configure the system to change the root directory. Then to move all your previous configuration to the new root file system.

Here the sketch:
https://github.com/Fede85/YunSketches/blob/master/YunOverlayOnSD/YunOverlayOnSD.ino

The advantage of this approach is that you only need to upload a sketch and follow the step-by-step procedure on the serial monitor.
The requirements are only the presence of the SD card in the socket and that the Yún is connected to internet.


The documentation to extend the storage space is documented on the OpenWRT wiki at the page called Rootfs on External Storage (extroot) (http://wiki.openwrt.org/doc/howto/extroot).


I would be glad if you want to try it and reply with the feedback or suggestions for improvements.
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on Apr 30, 2014, 09:41 am
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
Code: [Select]

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
Code: [Select]

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
Code: [Select]

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
Title: Re: How to expand the storage memory on the Yún
Post by: mamu on Apr 30, 2014, 08:01 pm
That sounds awesome!
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on May 01, 2014, 05:38 am
It worked for me. Thanks
Title: Re: How to expand the storage memory on the Yún
Post by: Gregg on May 06, 2014, 08:29 pm
Does not look like the link to the sketch is working anymore (Page not found)?
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on May 06, 2014, 08:31 pm
https://github.com/Fede85/YunSketches/blob/master/YunDiskSpaceExpander/YunDiskSpaceExpander.ino (https://github.com/Fede85/YunSketches/blob/master/YunDiskSpaceExpander/YunDiskSpaceExpander.ino)
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 06, 2014, 09:48 pm
We have also published it as a downloadable zip file. It's in the latest blogpost http://blog.arduino.cc/2014/05/06/time-to-expand-your-yun-disk-space-and-install-node-js/
Title: Re: How to expand the storage memory on the Yún
Post by: NewLine on May 06, 2014, 10:49 pm
This is a really good idea!
However I would rather just run/tweak the Linux script instead of via the sketch. Any Chance of publishing this? If not, I'll extract it from the sketch myself.
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on May 07, 2014, 01:27 am
http://forum.arduino.cc/index.php?topic=228204.msg1653830#msg1653830 (http://forum.arduino.cc/index.php?topic=228204.msg1653830#msg1653830)
Title: Re: How to expand the storage memory on the Yún
Post by: roadfun on May 07, 2014, 03:08 am
Does running the Yun from the microSD have any impact on performance? I.e. what is the relative performance of a typical microSD vs the onboard memory?

Thanks.
Title: Re: How to expand the storage memory on the Yún
Post by: roadfun on May 07, 2014, 04:30 am
My first Yun conversion went smoothly. But my second one failed (error detailed below). I surmised this was a issues with free space on / (of course that's why I was happy to see this extension scheme). I recalled I was at about 90% before running the conversion script. I removed a couple of packages to get to 83% full on / and re-ran the sketch. It ran correctly.

Bottom line is you may want to ensure you have about 80% free space on / before running this conversion.

Software list updated. Installing software (this will take a while)...
err. installing e2fsprogs mkdosfs fdisk
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 07, 2014, 09:57 am
Thank you @roadfun, we'll try to check free space before running it

Regarding performance, we observed similar performances. However, when running on the SD card the Yun could go much much faster

When configuring the SD card, we forced writes to be in sync (https://github.com/Fede85/YunSketches/blob/master/YunDiskSpaceExpander/YunDiskSpaceExpander.ino#L267)
This ensures that files do not corrupt even if you suddenly unplug the yun while you're writing a file (or at least this reduces the changes that such a corruption may happen)
However, if you just run  the following command
Code: [Select]
mount -o remount,async /dev/sda2
you'll see a great performance improvement (this is temporary: once you'll reboot, it will get back to "sync")

This is much more unsecure as files may get corrupted or you may lose data if the yun loses power while writing on the SD card

It's a trade-off and we chose with the conservative way as it is more secure and gives you a similar experience
Title: Re: How to expand the storage memory on the Yún
Post by: Federico_Vanzati on May 07, 2014, 12:59 pm

My first Yun conversion went smoothly. But my second one failed (error detailed below). I surmised this was a issues with free space on / (of course that's why I was happy to see this extension scheme). I recalled I was at about 90% before running the conversion script. I removed a couple of packages to get to 83% full on / and re-ran the sketch. It ran correctly.

Bottom line is you may want to ensure you have about 80% free space on / before running this conversion.

Software list updated. Installing software (this will take a while)...
err. installing e2fsprogs mkdosfs fdisk



@roadfun: Good point! thank you!!
I've checked and the 4 software you need to install for this procedure requires around 700KB.
So, I've added a function that checks if you have at least 1MB of free space on the flash memory and stops the procedure if you don't have enough space.

You can find the updated code on github or at zip attached to the tutorial page: http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace
Title: Re: How to expand the storage memory on the Yún
Post by: Federico_Vanzati on May 07, 2014, 01:07 pm

This is a really good idea!
However I would rather just run/tweak the Linux script instead of via the sketch. Any Chance of publishing this? If not, I'll extract it from the sketch myself.


We decided to adopt the "Arduino sketch way" to keep the procedure as simple as possible (means you don't have to deal with the Linux terminal).
I'm sorry but we are not going to publish a Linux bash script with the same commands. However, extracting them form the sketch is very simple.
Title: Re: How to expand the storage memory on the Yún
Post by: EnricoSandoni on May 07, 2014, 04:22 pm
the procedure has been easy, thanks but during this I haven't read carefully and I made the Linux partition bigger than I wanted and trying to do the procedure again "arduino" says that the sd is already been prepared/modified..how can I do?

I know I am an asshole, but thanks for answering!
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 07, 2014, 04:59 pm
Unplug the sd and reboot the yun. Access it via ssh and edit file /etc/config/fstab as said in the previous post
http://forum.arduino.cc/index.php?topic=236696.msg1702476#msg1702476 ("If you encounter any error...")
Then rerun the procedure
Title: Re: How to expand the storage memory on the Yún
Post by: tdicola on May 07, 2014, 11:01 pm
Wow this is awesome, thanks for making the process easy and repeatable.  Looking forward to installing a lot more packages with the room available.

Dumb question, but has anyone tried installing and using GCC on the yun and an expanded filesystem? :)  I'm guessing the limited memory and CPU will make compiling anything serious impossible, but it should be possible to do simple stuff right?
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 08, 2014, 08:57 am
The only known way for that is cross compiling. Start here
Title: Re: How to expand the storage memory on the Yún
Post by: NewLine on May 11, 2014, 12:01 pm
Suppose I have 2 Yuns. On Yun1 I do the above and actually move the OS to the SD card.

Yun2 still uses the flash. How difficult would it be to modify Yun2 so that is works from the SD card from Yun1?

I am thinking of using the SD card as a way of distributing the whole setup of a Yun to people that do not want to configure the Yun themselves. It would be great if they could buy a Yun, plugin the SD-card and done.
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 11, 2014, 12:08 pm
It is as difficult as modifying a conf file on the flash 8) See last part of my reply at http://forum.arduino.cc/index.php?topic=236696.msg1702476#msg1702476

You need to write that piece of conf instead of removing it
Title: Re: How to expand the storage memory on the Yún
Post by: dctsystems on May 15, 2014, 11:45 am

Dumb question, but has anyone tried installing and using GCC on the yun and an expanded filesystem? :)  I'm guessing the limited memory and CPU will make compiling anything serious impossible, but it should be possible to do simple stuff right?


Seconded on the request for someone to figure this out...

Unix without a native C compiler is pretty limited. The suggestion to cross compile is valid if you're rebuilding the OS, but is very problematic for "normal" people. It only works on one or two specific versions of Linux - No Mac compiling, and definitely no Windows support. The process of building the cross compiler is torturous to say the least. Everyone reports problems.

If there was an easily available, and simple to use cross compiler that shipped with the Arduino IDE then that would be a good start, but currently cross compiling "helloWorld" from scratch is days of work, and would require setting up a VM just of that purpose.

The suggestion that it's impractical to compile natively is bogus. Especially with this upgrade in place, storage is no longer an issue, and 400MHz/64Mb is actually pretty decent (I've compiled GCC on a 16MHz Machine with 4Mb RAM - it took pretty much a whole day, but that was totally OK).

The Linux side of the Yun is currently underused, because there's no easy way to write C programs for it...

This isn't meant to sound ungrateful - I appreciate the progress being made on the Yun.  I'm just hoping to get this onto the todo list, as it would radically change the way we could work with the YUN.
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on May 15, 2014, 12:07 pm

The suggestion that it's impractical to compile natively is bogus. Especially with this upgrade in place, storage is no longer an issue, and 400MHz/64Mb is actually pretty decent (I've compiled GCC on a 16MHz Machine with 4Mb RAM - it took pretty much a whole day, but that was totally OK).


I would love to see an installable gcc on the yun! It would also be a nice contribution to OpenWrt, that (AFAIK) has never had a installable package for gcc in 10 years
Since you've already done that, you may want to contribute with your experience
Title: Re: How to expand the storage memory on the Yún
Post by: dctsystems on May 15, 2014, 02:07 pm
Fair call... I'll look into it...

I've seen a couple of people say they've had something working, but nothing released. The biggest problem is... there's no simple C compiler for Yun! Need to build the native compiler with a cross compiler, which I need to build on Debian,  which is a pain.

Ian
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on May 15, 2014, 06:58 pm
The MIPS Linux pull request for the 3.14 kernel provides support for the MIPS interAptiv and proAptiv processor cores...

http://www.phoronix.com/vr.php?view=MTU4ODM (http://www.phoronix.com/vr.php?view=MTU4ODM)
Title: Re: How to expand the storage memory on the Yún
Post by: dctsystems on May 17, 2014, 12:50 pm

I would love to see an installable gcc on the yun! It would also be a nice contribution to OpenWrt, that (AFAIK) has never had a installable package for gcc in 10 years
Since you've already done that, you may want to contribute with your experience


http://www.sniff.org.uk/2014/05/building-gcc-for-yun-in-12-not-easy.html

Done!

It was a torturous process, but I've got a working GCC toolchain running on Yun. It's got a couple of hacks in places and its completely untested, but I've complied a couple of simple test programs with it.

I'm currently making a tar file with a complete toolset in, and I'll add a link to that as soon as its uploaded somewhere. Hopefully my notes can help someone else to a better job, and turn into a proper installable package.
Title: Re: How to expand the storage memory on the Yún
Post by: nicklin on May 18, 2014, 08:45 pm
The sketch worked great, but as I noted in a separate thread, for me the 2GB data partition I specified runs around 12 times slower than the ext4 overlay partition. Rebooting without the sd card, inserting and reformatting sda1 as ext4 dropped a 1MB file create from 120 seconds to around 7 seconds.
Title: Re: How to expand the storage memory on the Yún
Post by: raylaw on Jul 16, 2014, 10:28 am
When I come to the Proceed with partitioning micro SD card ,
I got err. formatting to FAT32.

I use a Kingston 8GB class 10 micro SD card.
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on Jul 16, 2014, 10:31 am
Can you change
Code: [Select]

#define DEBUG 0


to

Code: [Select]

#define DEBUG 1


and paste the output?
Title: Re: How to expand the storage memory on the Yún
Post by: raylaw on Jul 16, 2014, 12:28 pm
This is the log :

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun.
Pleaseyou have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever.
Do you wish to proceed (yes/no)? yes


Starting Bridge...


Ready to install utility software. Please ensure your Arduino Yun is connected to internet.
Ready to proceed (yes/no)? yes

Updating software list...

Software list updated. Installing software (this will take a while)...

e2fsprogs mkdosfs fdisk rsync installed


Proceed with partitioning micro SD card (yes/no)? yes

Enter the size of the data partition in MB: 4000

Partitioning (this will take a while)...

mkfs.vfat 3.0.12 (29 Oct 2011)

err. formatting to FAT32

-----------------------------------

This is the system info :

Firmware Version    Linino Barrier Breaker devel / LuCI Trunk (svn-r9877)
Kernel Version            3.8.3

----------------------------------

First I try to reinstall the OpenWrt-Yun image by the web panel.
The WLAN keep blinking over 10-15 minutes and don't stop , which I think it is not right.

Then I try to do it using Terminal and I got the following error :
root@MyArduino:~# run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squash
fs-sysupgrade.bin
cp: read error: Input/output error

Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on Jul 16, 2014, 02:37 pm
I'd say the sd card is broken
Title: Re: How to expand the storage memory on the Yún
Post by: raylaw on Jul 17, 2014, 07:28 am
Actually , I bought 2 same SD cards , both of them can not pass the step too.

They run perfectly fine on mac and window, showing that it has around 8 GB free space.

However , when I test it on Arduino UNO with Ethernet shield, running the CardInfo example, I got strange  result :

Volume type is FAT32

Volume size (bytes): 3654471680
Volume size (Kbytes): 3568820
Volume size (Mbytes): 3485

Files found on the card (name, date and size in bytes):

It shows only around 4GB space.

Does it mean Arduino has some max limitation on the SD volume ?
or Class 10 card , or Kingston brand card does not work on Arduino ?

Title: Re: How to expand the storage memory on the Yún
Post by: raylaw on Jul 18, 2014, 06:07 am
Is it the matter of using a Micro SDHC card rather than Micro SD card ?
Have anyone use the Mirco SDHC card can pass the step ?
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on Jul 18, 2014, 09:54 am
AFAIK, SDHC are supported http://forum.arduino.cc/index.php?topic=214467.0
Title: Re: How to expand the storage memory on the Yún
Post by: NewLine on Jul 18, 2014, 10:09 am
When the file-system is moved to the SD card (pivot root using:

Code: [Select]
config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0


is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?
Title: Re: How to expand the storage memory on the Yún
Post by: infotorpk on Jul 25, 2014, 10:38 am
hi ,
          when the running the script , i got the following error.

"err formatting fat32"

Please  help me to resolve this issue.Size of the micro sd card is 8GB


Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on Jul 25, 2014, 04:24 pm

...
is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?


Power off Yun , take out SD card. power on Yun again to access flash.
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on Jul 25, 2014, 04:28 pm

hi ,
          when the running the script , i got the following error.
"err formatting fat32"
Please  help me to resolve this issue.Size of the micro sd card is 8GB


take out SD card, put it into Windows machine to test format.

or

at Yun

Code: [Select]
fdisk /dev/sda
mkdosfs -F 32 /dev/sda1



partition and format SD card.
Title: Re: How to expand the storage memory on the Yún
Post by: Alomamabobo on Oct 19, 2014, 07:13 pm
Thanks for the script :)
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Oct 31, 2014, 04:49 pm
Is there a way to access the filesystem that is still on the flash, without removal of the SD card?
E.g. how can I access the /etc/config/fstab file on the Yun flash?
I found this tip on accessing the original flash drive while booted up on the external root: http://wiki.openwrt.org/doc/howto/extroot#accessing.original.root (http://wiki.openwrt.org/doc/howto/extroot#accessing.original.root)

Basically, you boot up under the expanded drive, and add this to the end of /etc/config/fstab:
Code: [Select]
config mount
option target /overlay-boot
option device /dev/mtdblock3
option fstype jffs2
option options rw,sync
option enabled 1
option enabled_fsck 0


Next time you boot up under the expanded drive, the original file system on internal flash will be available under /overlay-boot. So to get to the original file system's fstab, use /overlay-boot/etc/config/fstab
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Oct 31, 2014, 05:06 pm
I just tried this last night. First, I downloaded the 1.5.2 firmware image, and reflashed the Yun using the web interface.

Then I loaded the sketch and ran it, and it seemed to be successful. I used an 8GB card, and allocated 6GB (6144MB) to the data partition. This is what I get when I run df:

Code: [Select]

root@Yun:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                24806184    500740  23061720   2% /
/dev/root                 7680      7680         0 100% /rom
tmpfs                    30560       100     30460   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/sda2             24806184    500740  23061720   2% /overlay
overlayfs:/overlay    24806184    50074  236172   2%/
/dev/sda1              6279168        12   6279156   0% /mnt/sda1
root@Yun:/#


sda1 is 6GB, as expected, but the rootfs is 24 GB? On an 8GB card? It should be 2 GB with about 25% used.

If I plug the SD card into my Windows laptop, it says that it is not formatted. If I look at it using a partition manager, it shows the first partition is a 6GB FAT32 partition (as expected) and the second is a 23.7 GB Linux Ext4 partition.

Why is the first partition not accessible on my laptop?

Why is the second partition so huge?

This is the sketch output when I run it with "DEBUG 1" defined:
Code: [Select]

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun.
Please ensure you have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever.
Do you wish to proceed (yes/no)? yes

Starting Bridge...

Ready to install utility software. Please ensure your Arduino Yun is connected to internet.
Ready to proceed (yes/no)? yes
Updating software list...
Software list updated. Installing software (this will take a while)...
e2fsprogs mkdosfs fdisk rsync installed

Proceed with partitioning micro SD card (yes/no)? yes
Enter the size of the data partition in MB: 6144
Partitioning (this will take a while)...

Command (m for help): Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): Partition number (1-4, default 1): First sector (2048-62333951, default 2048): Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-62333951, default 62333951): Partition 1 of type Linux and of size 6 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Command (m for help): Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): Partition number (1-4, default 2): First sector (12584960-62333951, default 12584960): Using default value 12584960
Last sector, +sectors or +size{K,M,G} (12584960-62333951, default 62333951): Using default value 62333951
Partition 2 of type Linux and of size 23.7 GiB is set

Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
mkfs.vfat 3.0.12 (29 Oct 2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1556480 inodes, 6218624 blocks
310931 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
190 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Allocating group tables:   0/190  <lengthy-count-sequence-snipped>  189/190       done                           
Writing inode tables:   0/190  <lengthy-count-sequence-snipped>  189/190       done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:   0/190  <lengthy-count-sequence-snipped>  189/190       done

Micro SD card correctly partitioned

Creating 'arduino' folder structure...
Copying files from Arduino Yun flash to micro SD card...
Enabling micro SD as additional disk space... enabled

We are done! Yeah! Now press the YUN RST button to apply the changes.


I snipped out a long string of counter updates that included lots of backspaces between each update. I also didn't include the messages from the subsequent boot (but I saved them if needed.)
Title: Re: How to expand the storage memory on the Yún
Post by: federicofissore on Oct 31, 2014, 05:54 pm
The only reason I get for having such a huge second partition is a tricky sd card. AFAIK, size of the sd card is written onto the sd card itself by the manufacturer. So you can make a 8G sd card and set its size to 24G

As for not being able to see the first one on windows, I don't know. Can you try with another sd card? An older one is better. A super new sd card may be unsupported by linux
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Oct 31, 2014, 06:08 pm
Oh my... well you can ignore the disk space part of the post. I got my cards confused, and it's actually a 32 GB card. And they play the marketing game where they say GB = 1,000,000 bytes instead of 1,048,576 bytes, so it's really about 30.5 GB. Take away 6GB for the data partition, and give up some overhead for formatting, and the reported size of the second partition sounds right.

So sorry for the confusion, it sure helps to actually look at the writing on the card! (I had it confused with some 8GB USB sticks I bought at the same time...) How embarrassing, I feel like such an idiot...  :-[

That still leaves the issue of not being accessible to Windows. The only other card I have at the moment is a 4GB card with some system critical data on it, and I'm hesitant to re-format it at the moment. But I will keep playing with it and see if I can figure anything out.

Thanks for the help, and sorry for the misleading information!
Title: Re: How to expand the storage memory on the Yún
Post by: heggood on Nov 01, 2014, 07:27 pm
As for the C compiler, it is now available via opkg.

opkg update
opkg install binutils
opkg install make
opkg install tar
opkg install yun-gcc

I installed it on my yun expanded on an SD.

I was very impressed by it's performance.

while I was at it, I installed make, gvim-full, and bash.

I was a little disappointed not to find flex and bison (gnu versions of lex and yacc) as I use the frequently
in my development environments.

I added a user other than root as I learned the danger of working as root long ago.  If you unwittingly do
something like rm * in a directory that you don't think you're in it can be catastrophic!
 
Since I found no admin tool such as user add, I did it the old way:

   edit /etc/group and add      slh:x:200:

   edit /etc/passwd and add    slh:x:200:200:slh:/home/slh:/bin/bash   

   edit /etc/passwd and add    slh:x:200:200:slh:/home/slh:/bin/bash

   mkdir /home/slh

   chown slh:slh /home/slh

   passwd slh

I installed and configured sudo since there is no su command.  This enables me to do sudo bash to temporarly become root.

I hope I didn't overlook anything in my instructions.  Enjoy!
Title: Re: How to expand the storage memory on the Yún
Post by: noblepepper on Nov 01, 2014, 09:43 pm
Quote
As for the C compiler, it is now available via opkg.

opkg update
opkg install binutils
opkg install make
opkg install tar
opkg install yun-gcc

I installed it on my yun expanded on an SD.

I was very impressed by it's performance.
:-) I had to learn much more than expected about *@#$%! openwrt package/makefiles than I expected to get that put together and still can't put one together easily.

I am very pleased with the functionality of yun-gcc at this point. It seems to be able to compile anything the hardware supports if you are willing to find and fill all the dependencies.
Title: Re: How to expand the storage memory on the Yún
Post by: rwaldron on Nov 07, 2014, 06:18 pm
Is there a limit to the sd-card's capacity? I can't get my Yun to recognize any sd-card that I have (they are all 32gb).

Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Nov 07, 2014, 10:50 pm
Is there a limit to the sd-card's capacity? I can't get my Yun to recognize any sd-card that I have (they are all 32gb).
I have several 32GB cards. The Yun recognized and accessed all of them when they are formatted as a single FAT32 partition.

Once I run the disk expander which creates an ext4 Linux partition and a FAT32 data partition, none of them are recognized.

Not a definitive answer, but one data point in trying to figure out what is and is not compatible?
Title: Re: How to expand the storage memory on the Yún
Post by: Angelo9999 on Nov 10, 2014, 04:26 pm
Are these SD cards recognized on a computer?

Try to run on your Yun with the SD inserted and post your output:

Code: [Select]
fdisk -l /dev/sda

Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Nov 10, 2014, 07:22 pm
Are these SD cards recognized on a computer?
Not sure who you're asking... me, or the guy I responded to who was having disk problems?

In case it's me, when my 32 GB card was a single large FAT32 partition, I could access it on my PC and my Yuns. Once I ran the expansion sketch which partitioned and formatted my 32 GB card, I can no longer access it from my PC.

Code: [Select]
root@Arduino1:~# fdisk -l /dev/sda

Disk /dev/sda: 31.9 GB, 31914983424 bytes
64 heads, 32 sectors/track, 30436 cylinders, total 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xac9bc88c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    50333695    25165824    c  W95 FAT32 (LBA)
/dev/sda2        50333696    62333951     6000128   83  Linux



If I run a partition manager on my PC, it shows very similar information (see attachment.)

Title: Re: How to expand the storage memory on the Yún
Post by: rwaldron on Nov 12, 2014, 11:15 pm
Are these SD cards recognized on a computer?

Try to run on your Yun with the SD inserted and post your output:

Code: [Select]
fdisk -l /dev/sda


Yes, they are recognized on a computer. I had a new Yun delivered yesterday which easily recognized the sd-card(s)--until it ceased responding at the end of a Yun-LininoOS upgrade.
Title: Re: How to expand the storage memory on the Yún
Post by: Angelo9999 on Nov 13, 2014, 11:12 am
Yes, they are recognized on a computer. I had a new Yun delivered yesterday which easily recognized the sd-card(s)--until it ceased responding at the end of a Yun-LininoOS upgrade.
Are they with a single partition or two partition?

@ShapeShifter:
Yes I was asking to you. By the way it seems good from fdisk output, honestly I don't know that the cause can be. I'll do some research about it.
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Nov 13, 2014, 08:26 pm
Thanks. When I insert it into my laptop, the access light on the card reader (internal card slot, not a USB reader) blinks about once a second, constantly (normally there is a few seconds of fast fluttering, then it only lights while actually being accessed.) The drive never mounts, and a windows never makes the book-beep sound when it is recognized and mounted. But the partitioning software (Paragon Partition Manager) has no trouble reading and displaying the partition data.
Title: Re: How to expand the storage memory on the Yún
Post by: otrcomm on Jan 04, 2015, 08:08 pm
Hello all - I am a newbee to the Yun and I am having difficulties expanding the storage memory. I have followed the tutorial, but keep getting various errors. When I load the YunDiskSpaceExpander.ino and walk through the prompts, sometimes I get the message "The micro SD card is not available." Other times I make it through creation of partitions and loading software to the SD card, but then at reboot with YUN RST button, I get error about unable to mount /dev/sda2.

Currently I am stuck at the "...micro SD card is not available" error.

I am using a 2GB SanDisk MicroSD Card and have tried two different cards.

Any ideas?

I got beyond the "... SD card not available" message and this is what I get when I reboot with YUN RST:

Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
[    9.600000] JFFS2 notice: (527) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 11 of xref (0 dead, 0 orphan) found.
[   11.380000] sd 0:0:0:0: [sda] 3899392 512-byte logical blocks: (1.99 GB/1.85 GiB)
[   11.380000] sd 0:0:0:0: [sda] Write Protect is off
[   11.390000] sd 0:0:0:0: [sda] No Caching mode page present
[   11.390000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.390000] sd 0:0:0:0: [sda] No Caching mode page present
[   11.400000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.400000]  sda: sda1 sda2
[   11.410000] sd 0:0:0:0: [sda] No Caching mode page present
[   11.410000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   11.410000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   31.930000] EXT4-fs (sda2): ext4_check_descriptors: Block bitmap for group 0 not in group (block 4294967295)!
[   31.930000] EXT4-fs (sda2): group descriptors corrupted!
mount: mounting /dev/sda2 on /overlay failed: Invalid argument
switching to jffs2
- init -

Any ideas here?

Thanks!
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Jan 04, 2015, 09:37 pm
I am using a 2GB SanDisk MicroSD Card and have tried two different cards.
Have you tried putting those cards in another computer, formatting them, copying 2GB of data to them, and then making sure you can read them back?

It's probably not your problem, but there are a lot of counterfeit cards out there. SanDisk is especially susceptible to the unscrupulous counterfeiters because they are such a widely known name. These counterfeit cards often don't work properly, or actually have less memory than stated. These are often sold as "upgraded" cards meaning that they are really smaller cards that have been fudged to report that they contain more memory than is really there. They start out working OK, so people think that all is well. But as the card fills up, it suddenly starts giving them trouble once it reaches the point where there is no more actual memory.

I'm not saying this is your problem. But since the disk expander sketch puts the Linux boot partition at the end of the card's space, problems would show up quickly if it were an "upgraded" counterfeit.

Put the cards in another computer, reformat them, and give them a good workout. If the cards don't work well in the other computer, they won't have a chance of working on the Yun.
Title: Re: How to expand the storage memory on the Yún
Post by: otrcomm on Jan 04, 2015, 10:43 pm
ShapeShifter - amitofo - thanks for the comeback. you hit the nail on the head. the "SanDisk" cards were bogus. I tried a MicroSD card and it worked perfectly.
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Jan 04, 2015, 11:41 pm
Hmmm... I don't know how to feel about this. I'm happy you got it working, but I'm sad you got stuck with bad cards.
Title: Re: How to expand the storage memory on the Yún
Post by: otrcomm on Jan 05, 2015, 01:01 am
Well it is ok from our stand point since the SanDisks work fine in our UNOs for data acquisition at various water wells that we have. So, now the Yun can be setup as the data acquisition hub on the internal network and send out sms messages if critical events occur.
Title: Re: How to expand the storage memory on the Yún
Post by: iamadog3333 on Jan 15, 2015, 11:45 am
 :'(
When I do the expand storage tutorial, opkg update procee  failed.

When I run the cmd "opkg update", connection to the server seems failed.
---
root@Arduinoyunzhang:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check failed.
Remove wrong Signature file.
Collected errors:
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz, wget returned 8.
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig, wget returned 8.
---

I also can not acess the URL from my Chrome Browser. I am at Beijing, China.
Any surgestions? Thank you.
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Jan 15, 2015, 04:01 pm
I think that error is usually due to an Internet connectivity problem. Given that you can't access the URL from Chrome, I think that clinches it. The problem doesn't appear to be with the Yun or opkg, but rather with your Internet connection. Until you can download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig with your browser, I wouldn't worry too much about trying to do it with the Yun.
Title: Re: How to expand the storage memory on the Yún
Post by: SoUpY on Jan 16, 2015, 01:06 am
I would like some clarification, although the answer may be painfully obvious: What exactly is moved on to the new root partition that you create? Is it only the files that you yourself create, or does it move other important files as well? In other words, in the future, what would I need to do if I lose the SD card or need to use a larger one?

EDIT: jessemonroy650, your probably right. I'll post/research in the future if I need to
Title: Re: How to expand the storage memory on the Yún
Post by: jessemonroy650 on Jan 16, 2015, 01:31 am
I would like some clarification, although the answer may be painfully obvious: What exactly is moved on to the new root partition that you create? Is it only the files that you yourself create, or does it move other important files as well? In other words, in the future, what would I need to do if I lose the SD card or need to use a larger one?
SoUpY,
Please start a new thread. This is off topic for this thread.

Jesse
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Jan 16, 2015, 12:10 pm
I don't know, I don't think it's that far of topic, at least not for a quick answer:

What exactly is moved on to the new root partition that you create?
The entire Linux file system is moved over.

Quote
what would I need to do if I lose the SD card or need to use a larger one?
Repeat the whole process - but first do a quick edit to the fstab of the on-board file system to undo the expansion. (See the "if you encounter any error" section of THIS POST (http://forum.arduino.cc/index.php?topic=236696.msg1702476#msg1702476).)
Title: Re: How to expand the storage memory on the Yún
Post by: iamadog3333 on Jan 27, 2015, 04:43 am
:'(
When I do the expand storage tutorial, opkg update procee  failed.

When I run the cmd "opkg update", connection to the server seems failed.
---
root@Arduinoyunzhang:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check failed.
Remove wrong Signature file.
Collected errors:
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz, wget returned 8.
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig, wget returned 8.

---
For Chinese guys, if Internet blocked, use the Files: 百度云盘
http://yun.baidu.com/share/link?shareid=840462841&uk=1950281063

Thanks to Angelo9999.


I also can not acess the URL from my Chrome Browser. I am at Beijing, China.
Any surgestions? Thank you.
Title: Re: How to expand the storage memory on the Yún
Post by: iamadog3333 on Jan 27, 2015, 04:50 am
:'(
When I do the expand storage tutorial, opkg update procee  failed.

When I run the cmd "opkg update", connection to the server seems failed.
---
root@Arduinoyunzhang:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check failed.
Remove wrong Signature file.
Collected errors:
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz, wget returned 8.
* opkg_download: Failed to download http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig, wget returned 8.
---



I also can not acess the URL from my Chrome Browser. I am at Beijing, China.
Any surgestions? Thank you.
For Chinese guys, if Internet blocked, use the Files: 百度云盘
http://yun.baidu.com/share/link?shareid=840462841&uk=1950281063

Thanks to Angelo9999.

And use this method:
nano /etc/opkg.conf
#src/gz attitude_adjustment http://downloads.arduino.cc/openwrtyun/1/packages
src/gz local file:////mnt/sda1/openwrtyun
opkg update

Thanks to sonnyyu.
http://forum.arduino.cc/index.php?topic=237178.msg2054049#msg2054049
-----------------
http://forum.arduino.cc/index.php?topic=292286.0
Title: Re: How to expand the storage memory on the Yún
Post by: sharkstooth26 on Mar 03, 2015, 12:16 pm
Hi. I have tried your tutorial and it works. It partitioned my SD card, but, how come when I compile my sketch the size of it still the same? Does the SD really expand the memory?
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Mar 03, 2015, 01:40 pm
It expands the amount of space available on the Linux system drive so that you can install more files into the Linux system. The "memory" it is referencing is the on-board flash memory that is used by Linux as a boot drive.

It has nothing to do with the amount of RAM in the Linux processor, nor does it have anything to do with the amount of RAM, PROGMEM, or EEPROM in the Arduino processor. There is nothing that can be done to increase the amount of these other types of memory.

Carefully re-read the first paragraph of the first post in this thread, it explains the limited scope of this upgrade. It's a very hand thing to do, but it does not affect sketch programming in any way.
Title: Re: How to expand the storage memory on the Yún
Post by: dave_98063 on Apr 10, 2015, 02:57 am
I got gcc to work three weeks ago, on three different Arduinos, but now I can't get the SD cards to work correctly.  Very annoying.

Once you get the SD cards initialized, and change the /overlay file system as needed (which is done by the memory expansion sketch), then you get to install the gcc environment using opkg.

The main things (from memory):
gcc is named (I think) yun-gcc, so you need to do this:  opkg install yun-gcc
That will not work, so it will then tell you to do a wget, followed by local image install.
You also need libc.  This should be loaded auto-magically.
Finally, you need to install bintools, if you actually want to run the program.
Oh, yeah, make would be good to have, too.




Title: Re: How to expand the storage memory on the Yún
Post by: jessemonroy650 on Apr 10, 2015, 04:40 am
I got gcc to work three weeks ago, on three different Arduinos, but now I can't get the SD cards to work correctly.  Very annoying.
::::SNIP::::

@dave_98063,
this is appears to be off topic. Please start a new thread. It appears you have a gcc install problem. Or something directly related to the actual install.

TIA
Jesse
Title: Re: How to expand the storage memory on the Yún
Post by: dave_98063 on Apr 10, 2015, 06:03 am
Agreed.  New thread will be called something like "Problems with SD card memory expansion"
Title: Re: How to expand the storage memory on the Yún
Post by: techalex on Apr 19, 2015, 05:58 pm
Will this help me with "the sketch is too big" error message?

Update: I guess I did not read carefully the thread. ShapeShifter explained it all. This hack is for the other side of the "bridge" where Linux lives.
So sad :) the Arduino's memory cannot be in crease.
Title: Re: How to expand the storage memory on the Yún
Post by: YesPapa on May 05, 2015, 10:59 pm
Hi,

How can we know which packages to delete? And do we have to re-install them after?

Thank for helping.

My first Yun conversion went smoothly. But my second one failed (error detailed below). I surmised this was a issues with free space on / (of course that's why I was happy to see this extension scheme). I recalled I was at about 90% before running the conversion script. I removed a couple of packages to get to 83% full on / and re-ran the sketch. It ran correctly.

Bottom line is you may want to ensure you have about 80% free space on / before running this conversion.

Software list updated. Installing software (this will take a while)...
err. installing e2fsprogs mkdosfs fdisk

Title: Re: How to expand the storage memory on the Yún
Post by: roadfun on May 05, 2015, 11:31 pm
This page (http://www.arduino.cc/en/Tutorial/YunPackageManager) has some info on 'opkg'. If you do a
Code: [Select]
opkg list it will show everything that's installed. Look for any optional packages you installed and remove however many you need in order to free up space using
Code: [Select]
opkg remove package_name. Just be careful not to remove the key system packages.
Title: Re: How to expand the storage memory on the Yún
Post by: YesPapa on May 06, 2015, 10:18 am
Thank for your reply.

Is it a way to have the default packages list of the board?

Thank you.
Title: Re: How to expand the storage memory on the Yún
Post by: sonnyyu on May 06, 2015, 11:37 am
To find out default installed packages list at board:

Code: [Select]
/usr/bin/reset-to-factory-anyway
reboot
opkg list-installed


Caution "reset-to-factory-anyway" will bring board back to factory default , anything you did will be reset.



Title: Re: How to expand the storage memory on the Yún
Post by: aabm01 on May 26, 2015, 05:54 pm
Hello

I have expanded my Yun with a 8GB microSD card and installed node.js and node-serialport.js, and everything was OK.

The next step was to edit the /etc/inittab, and before doing it I wanted to check whether unplugging the microSD card, I could access SSH via serial port COM with the root file system that is in the flash memory.

Once I was checked that it was Ok. I wanted to plug the microSD card again to work with my Yun expanded, so I unplugged my Yun, plug the microSD card and plug the Yun again and when I enter via SSH and typed:

root@ofcyun:/# df -h / /mnt/sda1
Filesystem                Size      Used Available Use% Mounted on
rootfs                    6.9M      1.3M      5.7M  19% /
df: /mnt/sda1: can't find mount point
root@ofcyun:/#

So it doesn't recognize the microSD card, I don't get errors , and I didn't edit the /etc/config/fstab.

Once I have plugged the microSD card I reboot both the Linux and Arduino parts.

So, Are there something that i have missed?  

Thanks
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on May 26, 2015, 06:49 pm
Hello
Please don't cross-post and ask the same question multiple times. It doesn't get your question answered any faster, and it only dilutes the responses by spreading any answers over multiple threads. It just wastes time and effort. I already responded in in your original thread. (http://forum.arduino.cc/index.php?topic=325356.msg2248917#msg2248917)
Title: Re: How to expand the storage memory on the Yún
Post by: aabm01 on May 26, 2015, 07:06 pm
Sorry you are right.

When I saw your answer to the other question I took the opportunity to ask the this question and forget delete or redirect this one.
Title: Re: How to expand the storage memory on the Yún
Post by: Siccc on Jun 01, 2015, 05:31 pm
Hi all,

did someones Yun ever show the "Not enough disk space"-Error, while using the diskExpander-Sketch?

I need some help hereby.....
Title: Re: How to expand the storage memory on the Yún
Post by: lamiastella on Jun 22, 2015, 08:48 am
Any idea why I am getting this instead of the windows shown in this tutorial? http://www.arduino.cc/en/Tutorial/ExpandingYunDiskSpace

Here's what I get:
http://i.imgur.com/GfrM17T.png

I am planning to install Node using opkg but I ran out of space so I came across this tutorial but it is not working either.
root@Arduino:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check passed.
root@Arduino:~# opkg install node
Installing node (v0.10.33-1) to root...
Collected errors:
 * verify_pkg_installable: Only have 2040kb available on filesystem /overlay, pkg node needs 3016
 * opkg_install_cmd: Cannot install package node.
root@Arduino:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    6.9M      4.9M      2.0M  71% /
/dev/root                 7.5M      7.5M         0 100% /rom
tmpfs                    29.8M    480.0K     29.4M   2% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3            6.9M      4.9M      2.0M  71% /overlay
overlayfs:/overlay        6.9M      4.9M      2.0M  71% /
/dev/sda1                 7.3G     46.8M      7.2G   1% /mnt/sda1

Any step-by-step commands that help me increase the step would be really great.
My MicroSD card is 8G.
Title: Re: How to expand the storage memory on the Yún
Post by: lamiastella on Jun 22, 2015, 09:58 am
I get this error in my SerialMonitor after I upload the sketch.
http://i.imgur.com/2tAKjKS.png
Any idea what is going wrong?
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Jun 22, 2015, 02:56 pm
I get this error in my SerialMonitor after I upload the sketch.
http://i.imgur.com/2tAKjKS.png
Any idea what is going wrong?
I replied in your other thread. (Please don't post the same question in multiple threads, it wastes time and effort.)

Use the USB connection in the Serial Monitor, not a network connection.
Title: Re: How to expand the storage memory on the Yún
Post by: W3b3r on Oct 15, 2015, 02:10 pm
I'm having trouble expand the memory to the SD card.
I use the IDE version 1.6.5 with Mac OS 10.10.5 (Yosemite).
When I try to upload the sketch YunDiskSpaceExpander.ino the following message appears:


O sketch usa 18.526 bytes (64%) de espaço de armazenamento para programas. O máximo são 28.672 bytes.
Variáveis globais usam 670 bytes (26%) de memória dinâmica, deixando 1.890 bytes para variáveis locais. O máximo são 2.560 bytes.

chmod: Unable to change file mode on /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude_bin: Operation not permitted

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude: line 6: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude_bin: Permission denied

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude: line 6: exec: /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude_bin: cannot execute: Undefined error: 0


Can someone help me?
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Oct 15, 2015, 04:16 pm
That sounds like a general problem uploading the sketch, and not specific to the disk expander sketch. Are you able to load any other sketches? Maybe try the standard Blink example?

The issue sounds like the problem is on your Mac, and not on the Yun. Perhaps the Arduino software is not installed properly, or you have an account permissions problem? I'm not familiar with the Mac version, so I can't give you any specific help.

Assuming you can't load any sketches, looking through the Installation & Troubleshooting (http://forum.arduino.cc/index.php?board=2.0) forum might give you some ideas, if not, that is probably a better place to post this problem.
Title: Re: How to expand the storage memory on the Yún
Post by: W3b3r on Oct 15, 2015, 04:50 pm
Thank you for your help!
You're right. The problem is with any sketch I try upload via USB.
Perhaps the problem is with the java version.

I'll keep trying to find a solution.

If anyone can help, I'm still waiting!
Title: Re: How to expand the storage memory on the Yún
Post by: leafarhz on Nov 29, 2015, 06:22 pm
Hey Guys, I had some of the same issues using a 16GB Samsung EVO, the program keeps freezing on the Partition and Format part of the code, Even when it seems like the YUN is compatible with this SD card, the command to format and/or partition clocks even when using SSH.
After lots of trial and error, I finally got it working, this is what I did:

I Basically all commands on the SSH (putty) console.
I will skip the ones that Federico's wrote for error checking and when directly to

opkg update
opkg install e2fsprogs mkdosfs fdisk rsync

after this comes the Partition and Format, what i did was partition the SD card on my Laptop, since I made the horrible mistake to upgrade to Windows 10 and dont want to use my work MAC for this, I used EASYUS  Partition Master, you can also use Partition Magic or a MAC or Linux computer, and basically created 2 partitions, one FAT32 and the other one EXT3 (couldnt find EXT4).

After I formatted the SD card, I put it back on the Arduino YUN and kept on going with the following steps.

mkdir -p /mnt/sda1
mount /dev/sda1 /mnt/sda1
mkdir -p /mnt/sda1/arduino/www
mkdir -p /mnt/sda2
mount /dev/sda2 /mnt/sda2
rsync -a --exclude=/mnt/ --exclude=/www/sd /overlay/ /mnt/sda2/
umount /dev/sda1
umount /dev/sda2
uci add fstab mount
uci set fstab.@mount[0].target=/overlay
uci set fstab.@mount[0].device=/dev/sda2
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit

after that, I rebooted and now i have the following with df -h / /mnt/sda1

root@yunrafa:~# df -h / /mnt/sda1
Filesystem                Size      Used Available Use% Mounted on
rootfs                    8.8G      7.9M      8.4G   0% /
/dev/sda1                 5.9G     20.0K      5.9G   0% /mnt/sda1


I hope that helps, not sure I i did it correctly.

Regards,

Rafael

Title: Re: How to expand the storage memory on the Yún
Post by: _Alain_ on Feb 03, 2016, 09:51 am
I'm not able to install a new SD-Card (16 GB).

I get an error saying something like "err. swap disk" (can't remember the exact words).
Before starting the sketch I saw in the webinterface "LuCi" that there is a new SD-Card, called "mnt/sd1" 14.? GB (why not 16 GB ?).

During the installingprocess I choosed 11000 MB for the first and 3000 MB for the second partition.

After the errormessage above, I tried to restart the installprocess but I get an error say "no sd disk" (can't remember the exact words).

Has anyone an idea what I do wrong ?
Is my SD-Card broken now ?

Kind regards
Alain
Title: Re: How to expand the storage memory on the Yún
Post by: _Alain_ on Feb 03, 2016, 12:35 pm
I found also this (https://www.twilio.com/blog/2015/02/arduino-wifi-getting-started-arduino-yun.html) solution which sounds mutch simpler to me.

It does just a few easy steps:



What do you think ? Is this a way to go too ?

Kind regards
Alain
Title: Re: How to expand the storage memory on the Yún
Post by: _Alain_ on Feb 03, 2016, 10:07 pm
...and now my Arduino Yun is not reachable anymore in the network.
I did reset to factory settings (holding down the WIFI-Reset-Button for 30 secondes) and did also reboot my router but nothing helps.

How can I bring him back to life ?

Edit 04.02.16
Replacing the "YunOverlayOnSD.ino" by the "blink.ino"-Sketch on the Arduino did bring back his heartbeat.
Title: Re: How to expand the storage memory on the Yún
Post by: ShapeShifter on Feb 04, 2016, 11:56 pm
This will update OpenWRT and I guess in the future this will also automatically (?) save any userfiles to the SD Card instead to the internal memory ?
I've not tried doing that, but I would be VERY surprised if that was the case.

There's updating the system software, and there's expanding the disk space (setting up a pivot root on the SD card.) Two very different operations.  I believe what you are describing is simply updating the system software.
Title: Re: How to expand the storage memory on the Yún
Post by: jessemonroy650 on Feb 06, 2016, 05:04 am
@_Alain_

Start a new thread, as this is now unrelated to your original issue.
On those directions by Twillio, I use twillio and I did not do something that convoluted.
FWIW: there are several directions available. Please start a new thread.

Jesse
Title: Re: How to expand the storage memory on the Yún
Post by: analogkid on Mar 04, 2019, 07:01 pm
I do not want to use an SD card at all, since there was a physical problem with my SD card slot. Is it possible to use a USB thumb drive to mount 'overlay'? I suppose it is a matter of altering the sketch to change the relevant paths?

TIA,
A
Title: Re: How to expand the storage memory on the Yún
Post by: jotadepicas on Apr 01, 2019, 04:39 am
After I formatted the SD card, I put it back on the Arduino YUN and kept on going with the following steps.

mkdir -p /mnt/sda1
mount /dev/sda1 /mnt/sda1
mkdir -p /mnt/sda1/arduino/www
mkdir -p /mnt/sda2
mount /dev/sda2 /mnt/sda2
rsync -a --exclude=/mnt/ --exclude=/www/sd /overlay/ /mnt/sda2/
umount /dev/sda1
umount /dev/sda2
uci add fstab mount
uci set fstab.@mount[0].target=/overlay
uci set fstab.@mount[0].device=/dev/sda2
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit

I just used your steps to expand an Arduino Dragino Yun Shield, and they worked, but the first time I tried them they didn't. Not exactly sure, but I suspected maybe I had to disable the already mounted overlay device (which in my case was /dev/mtdblock3). So before entering your uci commands, I did:

uci add fstab mount
uci set fstab.@mount[0].device=/dev/mtdblock3
uci set fstab.@mount[0].enabled=0
uci commit


As I said, not really sure this was an issue, but the second time I tried this and it worked.

Otherwise, your solution worked fine, thanks!
Title: Re: How to expand the storage memory on the Yún
Post by: ethanhall9 on Apr 21, 2019, 07:06 pm
The SD card expansion procedure for Arduino Yún Rev 2 does not seem to work (for me, at least).

The SD card becomes available, but the Yún does not run Linux from it nor does it let me install packages on it, so I am left with very little space for software.

Also, it seems that the software does not get very frequent updates. Is there an alternative?

I get this error message in the serial console (see log below):

*** Warning - bad CRC, using default environment

The Yún runs LEDEYun 17.11, r6773+1-8dd3a6e (came pre-installed) and I am using a 16 gig SD card from Kingston.

I have followed the guide here:
https://www.arduino.cc/en/Guide/ArduinoYun

The guide states:
"You can use external memory like a microSD card or thumb drive for saving data, or your own scripts, web pages, etc. For the Yún rev. 2 to access and store information on these drives through the 32U4, they need to have a directory named arduino in the root of the volume. If you plan to use a microSD memory card, you can expand the Yun Disk Space following this tutorial."

Said tutorial has a link for the Rev 2 and states that I can install packages and run the system from the SD card.

I followed the tutorial, and used this sketch:
https://github.com/arduino/yun-go-updater/blob/master/YunDiskSpaceExpander/YunDiskSpaceExpander.ino

Here is the entire log from the serial console (redacted for privacy):

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun.
Please ensure you have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever.
Do you wish to proceed (yes/no)? yes

Starting Bridge...

Ready to install utility software. Please ensure your Arduino Yun is connected to internet.
Ready to proceed (yes/no)? yes
Updating software list...
Software list updated. Installing software (this will take a while)...
e2fsprogs dosfstools fdisk rsync kmod-fs-ext4 installed

Proceed with partitioning micro SD card (yes/no)? yes
Enter the size of the data partition in MB: 6000
Partitioning (this will take a while)...
Micro SD card correctly partitioned

Creating 'arduino' folder structure...
Copying files from Arduino Yun flash to micro SD card...
Enabling micro SD as additional swap... enabled

Enabling micro SD as additional disk space... enabled

We are done! Yeah! Rebooting to apply the changes.reboot
root@Arduino:~# [ 4329.066125] wlan0: deauthenticating from [Redacted: mac address] by local choice (Reason: 3=DEAUTH_LEAVING)
[ 4332.215945] Removing MTD device #5 (rootfs_data) with use count 1
[ 4332.238119] reboot: Re⸮

U-Boot 1.1.5-linino-g2d891225 (Nov 22 2017 - 09:06:12)

Linino Board (ar9331) U-boot
DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 218k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   eth0: [Redacted: mac address]
eth1: [Redacted: mac address]
eth0, eth1
autoboot in 4 seconds (stop with 'ard')...
## Booting image at 9f050000 ...
  Image Name:   MIPS LEDEYun Linux-4.9.91
  Created:      2018-04-27   9:20:02 UTC
  Image Type:   MIPS Linux Kernel Image (lzma compressed)
  Data Size:    1471362 Bytes =  1.4 MB
  Load Address: 80060000
  Entry Point:  80060000
  Verifying Checksum at 0x9f050040 ...OK
  Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 4.9.91 (arduino@openwrt-yun) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6773-8dd3a6e) ) #0 Tue Apr 24 17:17:07 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1


... Redacted because of message size restrictions on the forum.