Rm: no space left. How to remove file without space?

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.

1 Like

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?

1 Like

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 ????

3 Likes

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.

3 Likes

Did you try emptying the dirt?

:laughing:

(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)