Please help me, my Pi has no space , I tried to delete a lot of packages , but it remain the same ,
I tried these commands :
sudo apt autoremove
sudo apt autoclean
sudo apt-get autoclean
sudo apt-get autoremove -y
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityRun sudo du -h -d 1 /
which will show the usage of top level directories.
You can then drill down unto the largest by replacing /
with e.g. /var
etc to find where the space is used.
8.0M /etc
636M /var
46M /boot
16K /lost+found
164K /root
0 /proc
8.6M /bin
80K /tmp
4.0K /srv
0 /dev
4.7G /usr
11M /sbin
2.4G /home
8.0K /media
9.7M /run
0 /sys
221M /opt
44K /mnt
357M /lib
8.3G /
I have been playing around with du
lately, and the default output can be difficult, especially for large directories containing many subdirectories.
The following script sorts by size, and excludes virtual directories, mount points etc.
Be patient; it can take a while before any output appears.
#! /bin/bash
# Print directory usage - sorted by size
if [ $# -eq 0 ] ; then
UDIR='.'
else
UDIR=$1
fi
if [ $UDIR == '/' ]; then
# exclude virtual directories, mount points etc which don't physically exist
# /tmp may (but usually doesn't) physically exist
sudo du -hd1 --exclude proc --exclude run --exclude sys --exclude dev --exclude boot --exclude mnt --exclude media $UDIR | sort -h
else
sudo du -hd1 $UDIR | sort -h
fi
This produces the following on my Pi
4.0K /srv
16K /lost+found
80K /tmp
164K /root
8.0M /etc
8.6M /bin
11M /sbin
222M /opt
318M /lib
920M /var
2.4G /home
4.7G /usr
8.4G /
This happened with me when I had an infinite loop in my python script with a print statement in it which ran continously but within few hours i was not able to connect with my raspberry pi as those print statements created huge logs in /var/log/syslog and the memory card was shown as completely occupied.
After deleting those logs everything came back to normal.
This looks pretty weird, so you may need to reset your Pi. You can use these 3 steps:
(Optional) 1. Backup important data to the cloud or an external drive. You may want to do this in case you want to keep stuff from your Pi.
Reflash Raspbian. If you use NOOBS, you can boot to recovery and install Raspbian again. Note: This may show up as Raspberry Pi OS. Otherwise, grab a PC, download an image, and flash using Rufus, Etcher, or if you're using Ubuntu, DD or Easy2Boot.
Setup your OS again. You may not need to reconnect to internet if you are using NOOBS Lite.
(Optional need) 4. Import data from a backup. You can copy all your data back from the cloud backup or your drive.
sudo du -sh /etc /var /usr /lib /home /tmp
- chances are one of those is going to be the culprit - at a guess it'll be/var
... specifically/var/log