rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Suddenly out of storage space

Tue Dec 29, 2015 5:26 pm

My raspberry is in a loop of restating after a few seconds.
I read that its possible that your pi its out of memory

So I ran code

Code: Select all

root@raspbmc:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 3.6G 3.4G 0 100% /
/dev/mmcblk0p1 69M 6.4M 63M 10% /boot
/dev/sda1 932G 913G 20G 98% /media/HDD
and i also ran

Code: Select all

root@raspbmc:/# du -csh *
5.9M bin
6.4M boot
4.0K dev
5.3M etc
863M home
54M lib
16K lost+found
16K media
4.0K mnt
133M opt
0 proc
112M root
500K run
7.6M sbin
15M scripts
4.0K selinux
24K splash
8.0K srv
0 sys
20K tmp
1021M usr
1.3G var
3.4G total

But now the question what can be deleted?
and why is my SD card suddenly full?

Are there certain files/folders which can be deleted every day/week? Just like within windows the Temp folder or temp internet files etc?

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

Re: Suddenly out of memory

Tue Dec 29, 2015 5:49 pm

Most temporary files are stored in /tmp\or /var/tmp. They get deleted when you reboot.

If you have been installing new software or software updates you will have some package files in the cache directory that are not needed. Some of those can be quite large. To clear them you can use "sudo apt-get clean".

You seem to have a 4GB card? That's a bit small for a full Raspbian system now, but there may be some software installed that you don't need and can be removed.

If your card is bigger than 4GB, perhaps you haven't run the "Expand root filesystem" option from the configuration utility yet (sudo raspi-config).

[edit]
I see you're running RaspBMC. In that case my points may not apply. I've not tried that one.

rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Re: Suddenly out of storage space

Tue Dec 29, 2015 6:21 pm

I will first copy all files to a new 8Gb (I first need to buy one) . I thought I had 8Gb.
But I did not install anything on this pi for a while so that's why I am surprised that;s its full

I will run sudo apt-get clean

and what about the other folders?

W. H. Heydt
Posts: 12671
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Suddenly out of storage space

Tue Dec 29, 2015 7:23 pm

You need to run "sudo raspi-config" and expand your root file system. That way, you will have almost 8GB instead of 3.4GB in use. Right now, over 4GB of your card is unallocated.

While you are in raspi-config, you can also set your keyboard, time zone, and location among other things.

rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Re: Suddenly out of storage space

Tue Dec 29, 2015 7:35 pm

To do that I first need to clone my 4Gb SD card into my just bought 8Gb card.

User avatar
Denngray
Posts: 58
Joined: Mon Nov 30, 2015 10:13 pm
Location: Clearfield, Utah
Contact: Website

Re: Suddenly out of storage space

Tue Dec 29, 2015 10:57 pm

rjobaan wrote:My raspberry is in a loop of restating after a few seconds.
I read that its possible that your pi its out of memory

So I ran code

Code: Select all

root@raspbmc:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 3.6G 3.4G 0 100% /
/dev/mmcblk0p1 69M 6.4M 63M 10% /boot
/dev/sda1 932G 913G 20G 98% /media/HDD
and i also ran

Code: Select all

root@raspbmc:/# du -csh *
5.9M bin
6.4M boot
4.0K dev
5.3M etc
863M home
54M lib
16K lost+found
16K media
4.0K mnt
133M opt
0 proc
112M root
500K run
7.6M sbin
15M scripts
4.0K selinux
24K splash
8.0K srv
0 sys
20K tmp
1021M usr
1.3G var
3.4G total

But now the question what can be deleted?
and why is my SD card suddenly full?

Are there certain files/folders which can be deleted every day/week? Just like within windows the Temp folder or temp internet files etc?
If you install your OS from NOOBS it will take advantage of all SD Memory, otherwise you need to config through command line in terminal.

sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then issue:

sudo resize2fs /dev/mmcblk0p2

The above command will run for a few minutes. You can then verify the filesystem size with df -h command.
Denn Gray Sysop of The Razz Pie BBS Telnet = razzpie.ddns.net:2300
port 2300 - Email me @ outwestbbs@gmail.com or denn@outwestbbs.com for any questions or advise on setting up Mystic BBS software. Website = razzpie.ddns.net

rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Re: Suddenly out of storage space

Tue Dec 29, 2015 11:53 pm

But before I do that better to get 8gb instead of 4 gb right?
So I first make a clone of my current SD card

User avatar
Denngray
Posts: 58
Joined: Mon Nov 30, 2015 10:13 pm
Location: Clearfield, Utah
Contact: Website

Re: Suddenly out of storage space

Wed Dec 30, 2015 4:23 am

rjobaan wrote:But before I do that better to get 8gb instead of 4 gb right?
So I first make a clone of my current SD card
If you have a raspberry PI 2 either 8gb, 16gb or 32 gb.
I use a 32 GB and show 28gb free in raspian.

Go here and get SDformater 4.0 https://www.sdcard.org/downloads/formatter_4/index.html
then use it to format your SD Card, then dload NOOBS and use that to install the OS you wan't, or if you want ubuntu mate follow the directions in my earlier post.

1.Install Ubuntu Mate
2.Follow these directions.
If you install your OS from NOOBS it will take advantage of all SD Memory, otherwise you need to config through command line in terminal.

sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then issue:

sudo resize2fs /dev/mmcblk0p2

The above command will run for a few minutes. You can then verify the filesystem size with df -h command.
Denn Gray Sysop of The Razz Pie BBS Telnet = razzpie.ddns.net:2300
port 2300 - Email me @ outwestbbs@gmail.com or denn@outwestbbs.com for any questions or advise on setting up Mystic BBS software. Website = razzpie.ddns.net

rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Re: Suddenly out of storage space

Wed Dec 30, 2015 7:42 am

I have the old pi (512mb) and I can not reinstall everything else because I already set up a few things.so I just want to make a clone.
But I m still wondering how it possible that my pi is full somehow...
And which commands can I do without erasing my configuration and data etc.

User avatar
DougieLawson
Posts: 39165
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Suddenly out of storage space

Wed Dec 30, 2015 10:17 am

sudo apt-get clean
find /var/log -type f | xargs sudo rm


That'll clean up a lot of crud and cruft.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”