Instructions for expanding space for openwrt programs. In most cases, 2Gb will be enough. We will install the necessary packages for working with USB devices
root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install nano kmod-usb-core block-mount kmod-fs-ext4 kmod-usb-storage-extras e2fsprogs blkidAfter install fdisk package
root@OpenWrt:~# opkg install fdiskInsert a flash drive into the router and create partitions
root@OpenWrt:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag
  Generic
   d   delete a partition
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)
  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes
  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): p
Disk /dev/sda: 1.9 GiB, 2013265920 bytes, 3932160 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
Disklabel type: dos
Disk identifier: 0xcad4ebea
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-3932159, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-3932159, default 3932159): +100M
Created a new partition 1 of type 'Linux' and of size 100 MiB.
Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (206848-3932159, default 206848):
Last sector, +sectors or +size{K,M,G,T,P} (206848-3932159, default 3932159):
Created a new partition 2 of type 'Linux' and of size 1.8 GiB.Changing the label of the first volume to Linux Swap
Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): 18 ---> 82
Changed type of partition 'Linux filesystem' to 'Linux swap'.
Save Changes
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
We format the second section for data in ext4
root@OpenWrt:~# mkfs.ext4 /dev/sda2
mke2fs 1.42.12 (29-Aug-2014)
/dev/sda2 contains a ext4 file system
        last mounted on Mon Oct 31 11:04:05 2016
Proceed anyway? (y,n) y
Creating filesystem with 465664 4k blocks and 116640 inodes
Filesystem UUID: ec33af13-8569-471e-a6d3-22b3ba95d6fd
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: donePreparing a section for swap
root@OpenWrt:~# mkswap /dev/sda1
Setting up swapspace version 1, size = 104853504 bytes
Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         2048  206847  204800  100M 82 Linux swap / Solaris
/dev/sda2       206848 3932159 3725312  1.8G 83 LinuxAfter the flash is ready, copy the overlay content to our partion /dev/sda2
mount /dev/sda2 /mnt
tar -C /overlay -cvf - . | tar -C /mnt -xf -
umount /mntLet's see uuid disk
root@OpenWrt:~# block info /dev/sda2
/dev/sda2: UUID="08514a99-ab63-43bd-9a99-ac83e0b4f240" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"Edit fstab
nano /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  target  '/overlay'
        option  uuid    '08514a99-ab63-43bd-9a99-ac83e0b4f240'
        option  fstype  'ext4'
        option  enabled '1'
config 'swap'
        option  device  '/dev/sda1'
        option  enabled '1'Save and reboot the router
root@OpenWrt:~# rebootLook what's out there with the free space
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.7G      3.4M      1.6G   0% /
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    13.9M     76.0K     13.9M   1% /tmp
/dev/sda2                 1.7G      3.4M      1.6G   0% /overlay
overlayfs:/overlay        1.7G      3.4M      1.6G   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# free
             total         used         free       shared      buffers
Mem:         28556        24332         4224           76         3008
-/+ buffers:              21324         7232
Swap:       102396            0       102396Profit! 👍