How to expand the storage memory on the Yún

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?

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 forum might give you some ideas, if not, that is probably a better place to post this problem.

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!

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

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

I found also this solution which sounds mutch simpler to me.

It does just a few easy steps:

  • Formating the SD Card with FAT (not FAT32) with a partition-software on a desktopcomputer (Important on Windows: Use Formatter to format the SD Card. Do NOT use MiniTool because with MiniTool the Arduino Yun will not find your SD Card and always get offline when you plug in the Card !)
  • Downloading the latest Build of OpenWRT an copy the *.BIN-File to the SD Card.
  • Plugin the SD Card to the Arduino Yun.
  • Reboot Arduinos OpenWRT and go to arduino.local, click RESET. 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 ?

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

Kind regards Alain

...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.

Alain: 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.

@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

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

leafarhz: 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!

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.

Error Unable to connect: retrying (0)... while following the directions to expand the sd detailed in below link.

https://www.arduino.cc/en/Tutorial/ExpandingYunDiskSpace

I'm trying to use a 2GB SDCard with an Arduino Yun rev2 by using the Arduino 1.18.10 Mac desktop software connected.

The port to which I'm connected is the network port (arduino yun's IP address)

I have this version:

BusyBox v1.28.3 () built-in shell (ash)


| |.-----.-----.-----.| | | |.----.| |_ | - || _ | -| || | | || _|| _| |__|| _|__||||______||| |___|

|__| W I R E L E S S F R E E D O M

LEDEYun 17.11, r6773+1-8dd3a6e

And the file system looks like this:

root@Arduino:/mnt/sda1# df -h / /mnt/sda1 Filesystem Size Used Available Use% Mounted on overlayfs:/overlay 5.6M 1.0M 4.5M 19% / /dev/sda1 1.8G 2.4M 1.8G 0% /mnt/sda1

Should I have to perform a "hard-reset" to my Arduino and follow the directions as first thing to do after the reset?

Any suggestion to solve my issue, it will be highly appreciated.

Follow the guidelines for How To Expand The YUN DISK SPACE https://www.arduino.cc/en/Tutorial/ExpandingYunDiskSpace

For the reboot, you need to press the YUN RST button. and then, you will see the context msg in the serial monitor.

You can press Enter twice or I would recommend you to install PUTTY(Optional) for serial communication and follow the guidelines below after your message in serial monitor:- Close Serial Monitor. Open Putty and do the steps below.

​​​ As you can see we have 2.5 GB of free disk space. As per the link Expanding YUN disk space, you can see the partition at the bottom of the page:-

df -h //mnt/sda1

The output should look like this:

Filesystem Size Used Available Use% Mounted on rootfs 1.2G 51.7M 1.0G 5%/ // This is the overlay partition and your files will be stored under this partitioned memory. /dev/sda1 698.6M 12.0K 698.6M 0%/mnt/sda1

Try installing one package after the opkg update for instance (opkg install python-pip or opkg install vim)

Go to the cd /usr/bin and type ls. You can see the list of installed packages over there plus python-pip and vim also.

Close the serial communication and remove the SD card, and, open the serial communication again and try searching the packages in cd /usr/bin by ls.

You won't see it as these packages are installed in the overlay partition i.e the memory card partitioned by Yun disk space expander.