Sunday, May 25, 2014

Moving the linux filesystem OpenWrt to the SD card

Standard the OS is on the flash of the Yun. It is possible to move (most) to the SD card.

Advantages are:
- much more space, allowing to install many more packages
- the flash can be written only a limited amount of times. If you move the OS to the SD card, this is no longer an issue. The SD card also has a limited amount of writes, but typically more than the flash, and it is much easier to replace the SD card than the flash.

Before starting, create at least one ext4 partition on the SD card (see e.g. http://myyafa.blogspot.be/2014/05/create-and-format-partitions-on-yun-sd.html)

On the Yun do (pivot root option):
opkg update
opkg install block-mount
cd /
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
umount /tmp/cproot
edit the file /etc/config/fstab and add:


config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
That's it. Reboot and the OS should now reside on the SD. If you still want to access the old filesystem on the flash (this is still used at boot for example) you can do
cd /
mkdir original-boot
and add
config mount
        option target   /original-boot
        option device   /dev/mtdblock3
        option fstype   jffs2
        option options  rw,sync
        option enabled  1
        option enabled_fsck     0
to the /etc/config/fstab file (see also http://forum.arduino.cc/index.php?topic=289215.0) (the one on the SD card)

No comments:

Post a Comment