I filled all my space and don't know how to remove files.
I tried such commands as dd, rm, vim (open file and removed content, but it didn't save).
How to delete file or clear space?
OpenWrt usually has the overlayfs file system structure, where the flashed firmware is /rom (read-only) and all changes are done to /overlay (read-write), and you normally see them combined as / , the normal file system.
(That means that if you try to delete files that were in the orignal firmware, you do not actually delete them, but you just create a new "deleted" mark for them into the the r/w overlay.)
You might try:
- cd into /overlay/upper and rm some files from there, directly from overlay. At least 128 kB or so, so that whole flash erase blocks get free. Then reboot, so that overlayfs gets reinitialised and notices the deletions you did.
- Boot into failsafe mode, mount rootfs there and delete some files. Then reboot normally.
Or you may try running "firstboot" that erases all your changes, and lets you to start like you had just flashed the router.
Thank you! I removed some files in /overlay folder, reboot device, but files deleted only on overlay and exist inside /usr/share folder
This is my fs table.
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 9911 9911 0 100% /
/dev/root 20736 20736 0 100% /rom
tmpfs 255888 24 255864 0% /tmp
/dev/by-name/rootfs_data
9911 9911 0 100% /overlay
overlayfs:/overlay 9911 9911 0 100% /
tmpfs 512 0 512 0% /dev
/dev/by-name/UDISK 110309 6108 98505 6% /mnt/UDISK
/dev/by-name/boot 4072 3262 810 80% /boot
/dev/by-name/boot-res
8151 39 8112 0% /boot-res
/dev/by-name/private 1009 5 1004 0% /mnt/SNN
overlayfs:/overlay/usr
9911 9911 0 100% /usr
"Then reboot, so that overlayfs gets reinitialised and notices the deletions you did."
Maybe exists some сommand to reinitialize it forcibly ?
Something is screwed there: you have piggy-back overlays:
Root "/" is mapped to overlayfs in "/overlay" and then there is also "/usr" separately in "/overlay/usr"
That does not look like a normal partition mapping at all.
Likely the overlapping overlays cause problems.
There should be no /overlay/usr, as it normally has the working directory "work" and the permanent storage "upper". Like here:
OpenWrt SNAPSHOT, r13148-0fb5962e62
-----------------------------------------------------
root@router1:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7424 7424 0 100% /rom
tmpfs 237932 2436 235496 1% /tmp
/dev/ubi0_1 76952 324 72664 0% /overlay
overlayfs:/overlay 76952 324 72664 0% /
tmpfs 512 0 512 0% /dev
root@router1:~# ls /overlay/
upper work
So, this line looks wrong to me:
overlayfs:/overlay/usr 9911 9911 0 100% /usr
In this unclear situation, wouldn't it be easiest and quickest to simply go into failsafe and just wipe everything with firstboot?
Just curious: How did you do that? By installing more packages than your router could take?
It's Xiaomi vacuum cleaner. Rooted. I don't sure I can connect to it via ssh.
Just upload non-chinese voices) My fault.
Running OpenWrt ????
Yes.
Linux TinaLinux 3.4.39 #567 SMP PREEMPT Thu Jun 20 02:54:56 UTC 2019 armv7l GNU/Linux
Sorry, TinaLinux is apparently some old IoT derivative of old OpenWrt, but likely not much common with the current OpenWrt.
Note that kernel 3.4.x has never been used in any OpenWrt release. Release 12.09 in 2013 used kernel 3.3 and the next one 14.07 in 2014 used kernel 3.10.
Did you try emptying the dirt?
(Sorry, I had to indulge.)
Welcome to the community and best wishes on your endeavor to clear the flash.
(maybe there's a reset button somewhere)
as many users are running out of space ...
(the reason, because writing/changing files on /overlay/work directory (see different threads about the format of RAM, etc ...
short explaination:
if you delete/change/write files on /etc (overlay/work/etc/...), then the file system is having limits, and only DOING on modifying =>
1.) mark file as deleted (NOT remove it and restore space)
2.) write file new to partition.
and that means, after time .- you are not having space left, and you would need to do everything from scratch ...
but that is often a lot of effort (installing and configuring all packages, etc ...
example to loose a lot of space, if you update packages, then you ran out of memory very very quick.
SIMPLE SOLUTION:
#######################################################################
IF OVERLAY FULL:
1. BACKUP:of overlay
tar -cvpzf /tmp/overlay.tar.gz /overlay/
then copy overlay.tar.gz to local backup system or to any other host (etc winscp)
2. CLEANUP + REBOOT (then on default firmware)
/rom/sbin/jffs2reset
and cofirm with key "y"
then let it do the cleanup/reformat - and then check with cmd: "top", til the cleanup process with mtd is finish - takes up to 2-5min
then do a reboot (and it will set the config back to 192.168.1.1) via:
reboot
########
when it is up, then connect via ssh / scp (eg: winscp) and:
3. RESTORE:
then copy overlay.tar.gz to local /tmp from your backup system
sysupgrade -r /tmp/overlay.tar.gz
then check with cmd: "top", til the full restore process is done with mtd stuff til the cpu is on almost 0% and not working in any other format/copy processes - takes up to 2-5min , then cmd:
reboot
#######################################################################
and everything is as before and you have space !!
have fun - cu Camel
@ADMIN: maybe someone can add something to FAQ.
i guess that methode would help a lot of people whicha re not having very much space, but still want to upgrade packages - without loosing space or need to reinstall the whole system, because of opkg packages upgrade. as that woulkd also working for such kind of things ..
or eg: changing/adjusting the sqm.cfg if the speed needs to be adjusted on limitation of internet speed (eg: i have a script, which is adjusting every day the sqm.cfg to handle my limitations of internet connection