How to expand the storage memory on the Yún

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:

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:

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

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

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!

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!

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.

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

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

rwaldron:
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?

Are these SD cards recognized on a computer?

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

 fdisk -l /dev/sda

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

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

Angelo9999:
Are these SD cards recognized on a computer?

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

 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.

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

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.

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!

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

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.

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.

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.

:cry:
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:


I also can not acess the URL from my Chrome Browser. I am at Beijing, China.
Any surgestions? Thank you.

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.

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