I can't quite understand this when I run arduino yun disk expander sketch with a sd card plugged in I get the the following message. You do not have enough flash memory need 1mb. I ssh into my arduino and I get this

Filesystem                Size      Used Available Use% Mounted on
rootfs                    6.9M    632.0K      6.3M   9% /
/dev/root                 7.5M      7.5M         0 100% /rom
tmpfs                     29.8M    148.0K     29.7M   0% /tmp
tmpfs                     512.0K       0    512.0K   0% /dev
/dev/mtdblock3            6.9M    632.0K      6.3M   9% /overlay
overlayfs:/overlay        6.9M    632.0K      6.3M   9% /
/dev/sda1                29.7G      2.4M     29.7G   0% /mnt/sda1

The only thing that is full is the /dev/root but the reading I have done through the posts here and online say that's fine. Why may this be I am quite confused???

1 Answer 1


I don't have a YUN or a lot of experience with OpenWRT, so I'm not sure I'm going to be of much help but, I'm guessing the error you're seeing is from this line of the sketch.

Excerpting that here:

Process awk;

awk.runShellCommand(F("df / | awk '/overlay/ {print $4}'"));
int output = awk.parseInt();
if (output < 1000) {
  Serial.println(F("\nYou don't have enough disk space to install the utility software. You need to free at least 1MB of Flash memory.\nRetry!"));

So, it appears they are executing df / | awk '/overlay/ {print $4}' on the YUN.

They're using awk to extract the fourth column ($4) of the line containing overlay (/overlay/), which by the way is awfully hackish.

Given that they expect the result of awk.parseInt() to compare less than 1000 to mean you have less than 1 Mbyte available, it's fairly clear they expected this column to be reported in kilobytes. And yet in your own df listing

overlayfs:/overlay        6.9M    632.0K      6.3M   9% /

the fourth column is 6.3M and the rest are choosing different units, what is sometimes called "human" output. So, we know what they care about is the overlay mount point. And that at the time someone tested this code it either they didn't try an SDCard of any size or the output of df was different back then, which is why parsing something like df isn't a good idea.

And that's about as far as I can take you with any real confidence. I don't know how overlay is set up on a YUN.

I guess, if you wanted to "fix" the code with a minimal change, it would be to add -k to the df command-line to force kilobyte based output, assuming -k works on whatever df comes with YUN. If you wanted to go a step further, I suppose you could use -P to get POSIX output from df, again assuming that's supported, and change the expected units in the sketch accordingly. But if this is just for you, and you know overlay has more than 1 MB free, you could just as easily change the function so it cannot fail:

void haltIfInternalFlashIsFull() {

All that said, I wouldn't be surprised if you run into another problem just like this in another part of the sketch.

  • yeah I got an error err. installing e2fsprogs dosfstools fdisk rsync kmod-fs-ext4 I've hacked away at this yun for a while. Such a headache. Dont know what to do at this point. Thanks anyways Nov 27, 2020 at 4:05
  • Given that it will probably be a long drawn out process, I'd steer your toward something interactive like a chat network for forum. About the only other thing I'll add here is that since most of the sketch seems to be executing shell command-lines on the YUN, you may get better help from people more knowledgeable in OpenWRT than in Arduino.
    – timemage
    Nov 27, 2020 at 4:10
  • Ok I will look in those forums. Thanks Im gonna select your answer because it solved the initital problem I had. Thanks Nov 27, 2020 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.