garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

size of used memory in root growing

Tue Aug 25, 2015 8:31 am

Hi
I have searched for an answer, so I apologise if this is documented elsewhere. First time here for me.
I have been running my Raspi as a VPN server, Samba NAS and Web Server for over a year without a hiccup.
But I have just noticed I am running out of room in the root partition.
I have not installed anything new and simply run update etc at least monthly.
Is this normal?
screen shot attached taken from RPi-Monitor
root.png
root.png (4.34 KiB) Viewed 1398 times

User avatar
Paeryn
Posts: 2680
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: size of used memory in root growing

Tue Aug 25, 2015 12:19 pm

Hmm, can't see the screenshot - it's just showing an empty box.

Is /var/log/ filling up? It's usually ok to remove archived files (those ending in .gz) unless you need any of them, though they don't usually take up that much space.

What about the apt cache? You can check the used size with

Code: Select all

du -h /var/cache/apt/archives
and you can free up space with

Code: Select all

sudo apt-get clean
She who travels light — forgot something.

garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

Re: size of used memory in root growing

Tue Aug 25, 2015 10:15 pm

Thanks for the reply Paeryn

The var\log file is only 7.2M
The size of the archives file was reported as 7.2K
apt-get clean didn't seem to do much (returned immediately) and the root file size did not change.
Sorry about the screenshot, attempt 2 attached....
You should be able to see (this time) that the root size has grown from 2.3GB to 5.3GB in 12 months, without any installations.
The little steps up are probably when I do an update and upgrade which I do whenever I happen to think of it.
This is no big issue, I'm just curious and trying in vain to learn linux.....
root_2.jpg
root_2.jpg (63.24 KiB) Viewed 1323 times

User avatar
Paeryn
Posts: 2680
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: size of used memory in root growing

Tue Aug 25, 2015 11:16 pm

That's averaging roughly 8MB per day over the year...

Is your samba NAS using an external HDD / memory stick or just the SD card? If it's an external/USB drive and you're constantly adding files to it but the drive isn't mounted then you'll end up adding files to the SD card.

Try looking at how much space each directory takes.

Code: Select all

du -h / | sort -h -r -k1,8 >dirsizes.txt
That'll create a (big) file listing all the directory sizes in order biggest->smallest, each directory size is inclusive of all its subdirectories. Use that to find which is taking all the space up.
She who travels light — forgot something.

garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

Re: size of used memory in root growing

Wed Aug 26, 2015 12:01 am

Hi Paeryn
My 2 x USB HDD's are mounted at /home/shares/public
There is >200GB in there so I think that side is ok..

I ran your code and (after removing HDD's) got a report that includes many many many entries such as this

/lib/modules/4.0.8+/kernel/fs
8.5M

Does this mean it is keeping old kernel modules? Can I remove these without issue? Is there an easy way to do this?

Thanks for the interest

User avatar
Paeryn
Posts: 2680
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: size of used memory in root growing

Wed Aug 26, 2015 1:02 am

garfield wrote:I ran your code and (after removing HDD's) got a report that includes many many many entries such as this

/lib/modules/4.0.8+/kernel/fs
8.5M

Does this mean it is keeping old kernel modules? Can I remove these without issue? Is there an easy way to do this?
I'm not sure what is supposed to uninstall the modules, apt-get seems to think none of the linux-modules packages are installed on mine.
I've got a few different kernel module dirs (and none of them correspond to the kernel version that uname reports), still, it shouldn't amount to a great deal. My /lib/modules dir totals 200M for 6 kernel versions (the oldest is dated a year and a half ago, the newest yesterday).
She who travels light — forgot something.

User avatar
rpdom
Posts: 15227
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: size of used memory in root growing

Wed Aug 26, 2015 7:22 am

Paeryn wrote:I'm not sure what is supposed to uninstall the modules, apt-get seems to think none of the linux-modules packages are installed on mine.
If you ran rpi-update at any time it will have installed modules that apt-get is unaware of, so won't uninstall. You will have to clear those ones out manually.

garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

Re: size of used memory in root growing

Wed Aug 26, 2015 9:37 pm

Thanks Paeryn
I will do some research and get a better understanding of this and how to use du etc better

Cheers

RobHenry
Posts: 452
Joined: Fri Sep 21, 2012 9:04 pm
Location: UK

Re: size of used memory in root growing

Wed Aug 26, 2015 9:47 pm

garfield wrote: how to use du etc better
try:

ncdu -x /

It gives a tree that you can navigate through sorted by directory size. You'll never go back to plain old du.

The -x switch excludes files on other devices (mounted usb drives etc.)

(you may need to apt-get install ncdu if you don't already have it)

garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

Re: size of used memory in root growing

Thu Aug 27, 2015 11:22 pm

Excellent thanks for the help.

garfield
Posts: 6
Joined: Tue Aug 25, 2015 8:25 am

Re: size of used memory in root growing

Fri Aug 28, 2015 9:24 am

Thanks all.
It was simply old modules. I have freed up nearly 1.5GB and have learned a little bit on the way

Return to “Troubleshooting”