0

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

E.g., 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...

Minix
  • 247
  • 4
  • 17
  • 2
    All items under `/proc` are generated by Linux automatically. I recommend not deleting any of these. If you have an i-node shortage, then `/proc` isn't your problem. They are being gobbled up somewhere else or your file system has some inconsistencies. Did you try running `fsck`? – lurker Jul 14 '13 at 17:42
  • `~ $ fsck -n /proc fsck 1.38 (30-Jun-2005) fsck: fsck.proc: not found fsck: Error 2 while executing fsck.proc for proc ~ $ fsck -n /sys fsck 1.38 (30-Jun-2005) fsck: fsck.sysfs: not found fsck: Error 2 while executing fsck.sysfs for sysfs ~ $ fsck -n /dev fsck 1.38 (30-Jun-2005) fsck: fsck.devfs: not found fsck: Error 2 while executing fsck.devfs for devfs ~ $ fsck -n /dev/pts fsck 1.38 (30-Jun-2005) e2fsck 1.38 (30-Jun-2005) fsck.ext2: while trying to open /dev/pts Could this be a zero-length partition? fsck.ext2: Warning... fsck.ext2 for device /dev/pts exited with signal 11. ~ $` – Dmitriy Novichkov Jul 14 '13 at 17:50
  • So, i must run fsck after restart? I'll check it later. – Dmitriy Novichkov Jul 14 '13 at 17:52
  • You don't run `fsck` on `/proc`. You run it on the file system. What does the output of your `mount` command look like? – lurker Jul 14 '13 at 17:53
  • 1
    Can you run `df -i`, it gives you more information about inode shortage. – Konstantin Weitz Jul 14 '13 at 17:54
  • '/ $ mount /dev/root on / type jffs2 (rw,noatime) proc on /proc type proc (rw,nodiratime) sysfs on /sys type sysfs (rw) devfs on /dev type devfs (rw) none on /syslog type tmpfs (rw) none on /tmp type tmpfs (rw) nome on /onvif type tmpfs (rw) none on /mempic type tmpfs (rw) none on /memrec type tmpfs (rw)' – Dmitriy Novichkov Jul 14 '13 at 17:57
  • 'df -i' is unknown options because it is BusyBox: 'BusyBox v1.1.2 (2008.07.18-08:25+0000) Built-in shell (ash)' So, there are 3 options for df: -i, -m, -k. – Dmitriy Novichkov Jul 14 '13 at 17:59
  • Are you certain that -i doesn't exist? The [manual](http://www.busybox.net/downloads/BusyBox.html) says it does – Konstantin Weitz Jul 14 '13 at 18:09
  • `~ $ df -i df: illegal option -- i BusyBox v1.1.2 (2008.07.18-08:25+0000) multi-call binary Usage: df [-hmk] [FILESYSTEM ...] Print the filesystem space used and space available. Options: -h print sizes in human readable format (e.g., 1K 243M 2G ) -m print sizes in megabytes -k print sizes in kilobytes(default)` Unfortunately, there are 3 options. – Dmitriy Novichkov Jul 15 '13 at 05:55

1 Answers1

1

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.

Paulo Scardine
  • 73,447
  • 11
  • 124
  • 153