0

Please help me, my Pi has no space , I tried to delete a lot of packages , but it remain the same , this is the disk status

I tried these commands :

sudo apt autoremove
sudo apt autoclean
sudo apt-get autoclean
sudo apt-get autoremove -y

enter image description here

enter image description here

3
  • 1
    run 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 Jan 11, 2021 at 20:38
  • Please don't post pictures of text. Instead copy the text direct into the question: Why not upload images of code/errors when asking a question?.
    – Ingo
    Jan 14, 2021 at 0:07
  • If you can't find the space used, then it may be hidden. If you the logs written to different directory that you mounted on /var/log, the space used before you mounted your other drive is still used up. And if you mount failed once, this could write many blocks of memory that will be hidden when you mount the other drive.
    – NomadMaker
    Sep 25, 2022 at 23:49

3 Answers 3

1

Run 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    /
0

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.

5
  • I don't think that the case , my raspberry was working well but when I connect a SIM module, that happened Jan 11, 2021 at 17:59
  • So did this happen soon after you connected the pi with sim module or it took some time? Jan 11, 2021 at 18:01
  • I don't know, since I connect the wires then I open my pi Jan 11, 2021 at 18:03
  • I just now delete many packages , but no changes in memory space even though it says there will be xxxx space free after delete this packages Jan 11, 2021 at 18:05
  • 1
    Maybe your card is failing and gone read only. Backup anything important before it fails completely.
    – CoderMike
    Jan 11, 2021 at 19:13
0

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.

  1. 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.

  2. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.