简体   繁体   中英

Cannot remove file using rm

I'm working with BusyBox v1.1.2 (2008.07.18-08:25+0000). I'd like to create new file, i use
touch ModelInfo
But response is
touch: ModelInfo: No space left on device
So, i check free space:

/web/en $ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                14.0M     13.8M    236.0k  98% /
none                    256.0k     68.0k    188.0k  27% /syslog
none                      1.0M         0      1.0M   0% /tmp
nome                      7.0M      6.3M    728.0k  90% /onvif
none                      1.0M         0      1.0M   0% /mempic
none                      6.0M         0      6.0M   0% /memrec

As I can see in Google, there is an issue with inodes. Ok, i run

for i in /*; do echo $i; find $i | wc -l; done

Output is the next:

/arm
      14
/bin
      81
/boot
      1
/capture
      2
/dev
    310
/disk
      9
/etc
     57
/hisi-pci
     13
/hisi-pci-wifi
     12
/home
      1
/komod
     72
/lib
     52
/lib64
      1
/linuxrc
      1
/lost+found
      1
/mempic
      5
/memrec
      5
/mm.sh
      1
/mnt
      1
/nfsroot
      1
/onvif
      2
/opt
      1
/param
     10
/proc
find: /proc/598/task/598/fd/56: No such file or directory
  16957
/root
      2
/sbin
     56
/share
      1
/sys
   1350
/syslog
      6
/tmp
      1
/usr
    171
/var
     17
/web
    522

So, in proc directory i can see a lot of directories 42, 443, 454, 548. etc - only digits. If i go to any of this directories, i can see the same content there:

/proc/580 $ ls -l
-r--------    1 root     root            0 Jul 14 17:51 auxv
-r--r--r--    1 root     root            0 Jul 14 17:48 cmdline
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 cwd -> /usr
-r--------    1 root     root            0 Jul 14 17:51 environ
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 exe -> /usr/hh580
dr-x------    2 root     root            0 Jul 14 17:51 fd
-r--r--r--    1 root     root            0 Jul 14 17:51 maps
-rw-------    1 root     root            0 Jul 14 17:51 mem
-r--r--r--    1 root     root            0 Jul 14 17:51 mounts
-rw-r--r--    1 root     root            0 Jul 14 17:51 oom_adj
-r--r--r--    1 root     root            0 Jul 14 17:51 oom_score
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 root -> /
-r--r--r--    1 root     root            0 Jul 14 17:51 smaps
-r--r--r--    1 root     root            0 Jul 14 17:48 stat
-r--r--r--    1 root     root            0 Jul 14 17:51 statm
-r--r--r--    1 root     root            0 Jul 14 17:51 status
dr-xr-xr-x    3 root     root            0 Jul 14 17:51 task
-r--r--r--    1 root     root            0 Jul 14 17:51 wchan

Eg, there is a content of "task" directory:

/proc/580/task $ ls
580
/proc/580/task $ cd 580
/proc/580/task/580 $ ls
auxv       environ    maps       oom_adj    smaps      status
cmdline    exe        mem        oom_score  stat       wchan
cwd        fd         mounts     root       statm
/proc/580/task/580 $ ls -l
-r--------    1 root     root            0 Jul 14 17:51 auxv
-r--r--r--    1 root     root            0 Jul 14 17:51 cmdline
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 cwd -> /usr
-r--------    1 root     root            0 Jul 14 17:51 environ
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 exe -> /usr/hh5800
dr-x------    2 root     root            0 Jul 14 17:51 fd
-r--r--r--    1 root     root            0 Jul 14 17:51 maps
-rw-------    1 root     root            0 Jul 14 17:51 mem
-r--r--r--    1 root     root            0 Jul 14 17:51 mounts
-rw-r--r--    1 root     root            0 Jul 14 17:51 oom_adj
-r--r--r--    1 root     root            0 Jul 14 17:51 oom_score
lrwxrwxrwx    1 root     root            0 Jul 14 17:51 root -> /
-r--r--r--    1 root     root            0 Jul 14 17:51 smaps
-r--r--r--    1 root     root            0 Jul 14 17:51 stat
-r--r--r--    1 root     root            0 Jul 14 17:51 statm
-r--r--r--    1 root     root            0 Jul 14 17:51 status
-r--r--r--    1 root     root            0 Jul 14 17:51 wchan

Is it possible delete any of these files (or links) to let system create new file? I really don't know Linux and I'd like create file only...

Some software can be deleting open files before closing them, an open handler to a deleted file prevents the disk space to be reclaimed. If this is the case, rebooting will free space. Older versions of MySQL used to carry such a bug, leaving hundreds of undead files under /tmp .

Use the lsof (list open files) command to see these files.

[update]

'lsof' is unknown command for this shell - it is BusyBox v1.1.2. – Dmitriy Novichkov

First confirm if the space is freed after rebooting, if not then your problem is not deleted open files. If rebooting fix the problem, look for a native binary of lsof or compile it for your platform (which you never hinted) in order to locate deleted files with open handlers, and may be you will be able to find the process responsible for the leak.

If you are running some home-made process that open and delete files, double check to see if you are closing files before deleting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM