Daily Archives: 2019-04-12

VoCore2: Extend Storage and Memory

This tutorial need preinstall kmod-fs-ext4.

Extend Storage

Openwrt is using overlay file system, so we can directly attach sd disk or usb disk to overlay use it as extend storage to store more applications.

Default /etc/config/fstab

config 'global'
option	anon_swap	'0'
option	anon_mount	'0'
option	auto_swap	'1'
option	auto_mount	'1'
option	delay_root	'5'
option	check_fs	'0'

config 'mount'
option device '/dev/sda1'
option enabled '1'

config 'mount'
option device '/dev/mmcblk0p1'
option enabled '1'

This defined VoCore will mount sd disk or usb disk automatically.

If we want to attach SD disk as /overlay to enhance the application storage, we need add one line.

...

 config 'mount'
 option device '/dev/mmcblk0p1'
+option target '/overlay'
 option enabled '1'

Then we will have a much bigger system disk.(call df show list)

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2816      2816         0 100% /rom
tmpfs                    62616       508     62108   1% /tmp
/dev/mmcblk0p1        29963132     45164  28372856   0% /overlay
overlayfs:/overlay    29963132     45164  28372856   0% /
tmpfs                      512         0       512   0% /dev
/dev/mmcblk0p1        29963132     45164  28372856   0% /mnt/mmcblk0p1

In LuCI it is looks like this:

Note: SD/USB storage file system better to be ext4. Other system should work too but might have some issues.

Extend Memory

This “extend memory” is not real memory, it is a swap buffer in SD disk or USB disk. To use it is very simple, just like we use swap in Linux.

Default firmware we already have necessary tools for swap.

  1. make an empty file(for example 128MB) as swap: dd if=/dev/zero of=/mnt/mmcblk0p1/swap bs=1M count=128
  2. setup it as swap file: mkswap /mnt/mmcblk0p1/swap
  3. add this swap to system: swapon /mnt/mmcblk0p1/swap
  4. check the swap: free
             total       used       free     shared    buffers     cached
Mem:        125232      98940      26292        888       3836      76424
-/+ buffers/cache:      18680     106552
Swap:       131068          0     131068