tylerecouture
Posts: 2
Joined: Tue May 10, 2016 9:26 pm

Pi full, keeps making swap files!

Tue May 10, 2016 9:37 pm

My Raspberry Pi is full and I think I found the problem, it appears to be creating swap files recursively, though I have no idea why.

Each of these has a 100MB swap file:
/proc/self/fd/15/var
/proc/self/fd/15/proc/self/fd/15/var
/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/var
/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/var
/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/var
/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/proc/self/fd/15/var
etc...

There are 20 of these!

Any idea what is going on? How can I delete these files? When I try to trash them in the GUI it fails.


tylerecouture
Posts: 2
Joined: Tue May 10, 2016 9:26 pm

Re: Pi full, keeps making swap files!

Wed May 11, 2016 3:47 am

Hmmm... could you elaborate? =D

User avatar
Rive
Posts: 586
Joined: Sat Mar 26, 2016 5:21 pm
Location: USA

Re: Pi full, keeps making swap files!

Wed May 11, 2016 3:51 am

tylerecouture wrote:
Hmmm... could you elaborate? =D
You want to know whats going on, look at the proc documentation...
DNPNWO

User avatar
PeterO
Posts: 4944
Joined: Sun Jul 22, 2012 4:14 pm

Re: Pi full, keeps making swap files!

Wed May 11, 2016 7:13 am

Do you have any idea what application is creating these files ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
topguy
Posts: 5686
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Pi full, keeps making swap files!

Wed May 11, 2016 10:11 am

Nothing under "/proc/" is actual files is it ? Its a virtual filesystem created by the kernel.

Code: Select all

df -h /proc/
Filesystem      Size  Used Avail Use% Mounted on
proc               0     0     0    - /proc
/proc/self is even more fun, "self" contain information about the process that is accessing /proc/self. It can be used by application to find out thing about themselves.
Do "cat /proc/self/cmdline" for example.

User avatar
jojopi
Posts: 3079
Joined: Tue Oct 11, 2011 8:38 pm

Re: Pi full, keeps making swap files!

Wed May 11, 2016 11:19 am

In this particular case, "/proc is not real" is not the whole story. The swap file does exist, and it is taking up disk space. But there is only one copy of it, and its actual path is /var/swap.

It is clear from the recursive paths in the original post that /proc/self/fd/15 was a symbolic link to /. So you could add that to the beginning of any path, as many times as you wanted.

I am not sure what program would do that, however. At the command line, /proc/self refers to a bash process, and bash should not normally have a file descriptor for the root directory open. Many recursive disk space utilities will keep open each directory they are searching—but they should not follow symlinks. The file manager, pcmanfm, closes each directory as soon as it has read it, so it does not appear to be possible to follow links recursively there.

User avatar
topguy
Posts: 5686
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Pi full, keeps making swap files!

Wed May 11, 2016 11:25 am

tylerecouture wrote:My Raspberry Pi is full and I think I found the problem.
I'm pretty sure you havent, the recursiveness you are seeing is caused by the special properties of "/proc/" and "/proc/self".
Exclude both /proc /sys and /dev from any searches related to filesizes.

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Pi full, keeps making swap files!

Wed May 11, 2016 11:28 am

du -k / | sort -nr

[edited for correctness]
Last edited by RaTTuS on Thu May 12, 2016 8:00 am, edited 3 times in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
topguy
Posts: 5686
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Pi full, keeps making swap files!

Wed May 11, 2016 11:30 am

RaTTuS wrote:df -h / | sort -nro
Are you sure you didn't mean "du" ?

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Pi full, keeps making swap files!

Thu May 12, 2016 7:57 am

topguy wrote:
RaTTuS wrote:df -h / | sort -nro
Are you sure you didn't mean "du" ?
:oops: yes - edited
I've also removed the o option on sort as it needs just to go to the display
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
PeterO
Posts: 4944
Joined: Sun Jul 22, 2012 4:14 pm

Re: Pi full, keeps making swap files!

Thu May 12, 2016 8:51 am

Code: Select all

du -h | sort -h 
is now my preferred combination of switches :-)
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Pi full, keeps making swap files!

Thu May 12, 2016 9:34 am

yeah I like that
I tend to use the -r option when it gets piped into files .....
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
jojopi
Posts: 3079
Joined: Tue Oct 11, 2011 8:38 pm

Re: Pi full, keeps making swap files!

Thu May 12, 2016 11:16 am

I was taught in human school (in geography, I think, not just science) that when you have a column of figures you pick a consistent unit and use it for the whole column. Who has the time to recognise which values are significant, otherwise?

I cannot abide the way df/du -h works, regardless of whether "sort" can handle it. Kilobytes are a bit small, so I mostly use df/du -m.

Return to “Troubleshooting”