fab
August 21, 2017, 1:50pm
1
Hi
I would like to get the real available storage space in my router. When I use df -h I get the following:
root@LEDE:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 2.8M 2.8M 0 100% /rom
tmpfs 250.8M 1.1M 249.7M 0% /tmp
/dev/ubi0_1 23.5M 56.0K 22.2M 0% /overlay
overlayfs:/overlay 23.5M 56.0K 22.2M 0% /
ubi1:syscfg 29.6M 252.0K 27.8M 1% /tmp/syscfg
tmpfs 512.0K 0 512.0K 0% /dev
The WRT1900ACS v2 comes with 128MB Flash; 512MB DDR3 RAM, LuCI reports Free space: 100% (23.46 MB) how can I find such info through terminal. I am used to lsblk but such is not available on busybox.
I think that 23.46MB is 23.5M (Size) - 56.0K (Used). The math doesn't fit perfectly, but maybe you should omit the '-h'.
fab
August 21, 2017, 2:19pm
3
@Mijzelf So is 23.46Mb available to install packages then?
root@LEDE:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 2816 2816 0 100% /rom
tmpfs 256800 1204 255596 0% /tmp
/dev/ubi0_1 24084 56 22764 0% /overlay
overlayfs:/overlay 24084 56 22764 0% /
ubi1:syscfg 30276 252 28440 1% /tmp/syscfg
tmpfs 512 0 512 0% /dev
No. That 23.46M is uncompressed space, I guess, while compression is used in the filesystem. So how much data you can store is dependent on it's compressibility.
fab
August 21, 2017, 3:17pm
5
@Mijzelf so how can I find out the real space available to store new applications please.
hnyman
August 21, 2017, 3:24pm
6
If you just want to install packages via opkg, use that 23 MB as the reference. The exact consumed file space will depend on the on-the-fly compression, but that might not be much for binaries.
Additionally, for data files, you also have the "syscfg" partition that is mounted to /tmp/syscfg and has about 28 MB free space. Note that syscfg is visible both alternative firmware partitions, so it can be used to store private files that should be usable regardless if you are runnign the firmware from the secondary or primary firmware partition. (LEDE only uses it to store settings during sysupgrade)
This is from wrt2300acm, so the number are slightly larger. You can notice how df only shows one kernel & rootfs partition, the alternative is hidden, but the syscfg is visible. "/proc/mtd" and kernel log show all partitions.
root@router2:~# dmesg
...
[ 1.046316] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128
[ 1.054009] pxa3xx-nand f10d0000.flash: ECC strength 16, ECC step size 2048
[ 1.061183] Bad block table found at page 131008, version 0x01
[ 1.067378] Bad block table found at page 130944, version 0x01
[ 1.073492] 11 ofpart partitions found on MTD device pxa3xx_nand-0
[ 1.079696] Creating 11 MTD partitions on "pxa3xx_nand-0":
[ 1.085212] 0x000000000000-0x000000200000 : "u-boot"
[ 1.090478] 0x000000200000-0x000000220000 : "u_env"
[ 1.095638] 0x000000220000-0x000000260000 : "s_env"
[ 1.100778] 0x0000007e0000-0x000000820000 : "devinfo"
[ 1.106095] 0x000000820000-0x000000a00000 : "sysdiag"
[ 1.111405] 0x000000a00000-0x000005a00000 : "kernel1"
[ 1.116874] 0x000001000000-0x000005a00000 : "ubi"
[ 1.121993] 0x000005a00000-0x00000aa00000 : "kernel2"
[ 1.127448] 0x000006000000-0x00000aa00000 : "rootfs2"
[ 1.132905] 0x00000aa00000-0x000010000000 : "syscfg"
[ 1.138289] 0x000000260000-0x000000820000 : "unused_area"
.
root@router2:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00020000 00020000 "u_env"
mtd2: 00040000 00020000 "s_env"
mtd3: 00040000 00020000 "devinfo"
mtd4: 001e0000 00020000 "sysdiag"
mtd5: 05000000 00020000 "kernel1"
mtd6: 04a00000 00020000 "ubi"
mtd7: 05000000 00020000 "kernel2"
mtd8: 04a00000 00020000 "rootfs2"
mtd9: 05600000 00020000 "syscfg"
mtd10: 005c0000 00020000 "unused_area"
.
root@router2:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 5888 5888 0 100% /rom
tmpfs 256608 1092 255516 0% /tmp
/dev/ubi0_1 55508 76 52564 0% /overlay
overlayfs:/overlay 55508 76 52564 0% /
ubi1:syscfg 71908 424 67780 1% /tmp/syscfg
tmpfs 512 0 512 0% /dev
/dev/ubi1_0 71908 424 67780 1% /mnt/ubi1_0
fab
August 21, 2017, 3:30pm
7
@hnyman thanks for the help. In my case tmpfs is really large compared to the rest, is this the norm. Can this be resized and increase the overlay
No. The tmpfs is in ram, so it won't survive a reboot.
fab
August 21, 2017, 3:37pm
9
Ok thanks. My last questions please if you don't mind me asking can I make a swap file on an external usb?
hnyman
August 21, 2017, 4:07pm
10
Why?
Usually that wastes performance.
General consensus is that swap is not necessary if you have well RAM like your device has.
I've been using LEDE for the past month on my WRT1900ACS and happy about the switch from another firmware project. Everything has been really stable, linux, wifi performance and all of the extra packages. I'm now trying to fine tune overall performance.
Extroot is setup and using a high quality USB3 flash drive with ware leveling. The disk has two partition; the first a 1GB swap, and the second about 30GB for rootfs (overlays).
Would you recommend adjusting swappinessl? The stable relese 17.01…
DjiPi
August 21, 2017, 4:15pm
11
If you have a particular need for a swapfile for a very specific situation, maybe this guide is what you are after:
https://wiki.onion.io/Tutorials/Extending-RAM-with-a-swap-file