Go Down

Topic: Use OverlayFS on MicroSD (Read 1 time) previous topic - next topic


Hello all,
I've just started working on the new Yùn, and I find it inspiring.
I wanted to share a neat trick I found for using the microSD card as filesystem expansion.

I got a 8Gb microSD and repartitioned it using a debian VM, so to have one 4 Gb partition formatted as vfat plus one 4Gb partition formatted as ext3. Once mounted on the Yùn, it sees the two partitions as /dev/sda1 (vfat) and /dev/sda2 (ext3).
Then I followed instructions on OpenWRT wiki with slight modifications:

tar -C /overlay -cvf - . | tar -C /mnt/sda2 -xf -
mkdir /mnt/sd

2. Added the following lines at the end of /etc/config/fstab:

config mount
        option device '/dev/sda1'
        option fstype 'vfat'
        option enabled '1'
        option target '/mnt/sd'

config mount
        option target        /overlay
        option device        /dev/sda2       
        option fstype        ext3               
        option options       rw,sync                       
        option enabled       1                               
        option enabled_fsck  0                                       

3. Reboot.

Now I have 4 Gb of exchange space available on the microSD, readable form Mac or Win PCs, plus other 4 Gb of disk space available to linino for installing additional opkg packages without wasting write-cycles of the embebbed eprom.

If the microSD is not available on boot, linino is booting fine, although, of course, additional packages installed via opkg are not available.

Here's the df output:
Code: [Select]

root@ArduinoPB:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                 3724584     18108   3513944   1% /
/dev/root                 7168      7168         0 100% /rom
tmpfs                    30568       144     30424   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/sda2              3724584     18108   3513944   1% /overlay
overlayfs:/overlay     3724584     18108   3513944   1% /
/dev/sda1              3896164      1016   3895148   0% /mnt/sd

You see that the root filesystem has exactly the same space as /dev/sda2, and it is in fact overlaid by the microSD partition.



Great! You anticipated us! Federico Vanzati is working out a tutorial to setup extroot using a sketch, so that you can just plug in the sd card and have it ready
Once done it would be nice to have your feedback. It should be published early next week


That's good to hear! I'll be glad to provide feedback. I have a class of students eager to be used as beta testers ;)

Go Up