fog4000
Posts: 1
Joined: Sat Apr 21, 2018 6:36 am

no more space, can't find the reason

Sat Apr 21, 2018 7:00 am

Hi,

I am having trouble since a few days with my Rpi3. The SD card is full but I can't understand which files or directory is using the space:
"df -h"

Code: Select all

pi@raspberrypi:~ $ df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/root           15G     15G     0 100% /
devtmpfs           426M       0  426M   0% /dev
tmpfs              430M       0  430M   0% /dev/shm
tmpfs              430M     12M  419M   3% /run
tmpfs              5,0M    4,0K  5,0M   1% /run/lock
tmpfs              430M       0  430M   0% /sys/fs/cgroup
/dev/mmcblk0p1      41M     21M   20M  52% /boot
tmpfs               86M       0   86M   0% /run/user/1000
command "du -sh *" shows that "home" is taking 12Gb

Code: Select all

8,1M	bin
21M	boot
4,0K	debian-binary
0	dev
18M	etc
12G	home
153M	lib
16K	lost+found
20K	man
12K	media
4,0K	mnt
233M	opt
0	proc
64K	root
12M	run
7,6M	sbin
4,0K	srv
0	sys
28K	tmp
2,2G	usr
273M	var
but "command du -sch /* | less" mentions only 4Gb are used:

Code: Select all

8,1M    /bin
21M     /boot
4,0K    /debian-binary
0       /dev
18M     /etc
933M    /home
153M    /lib
16K     /lost+found
20K     /man
12K     /media
4,0K    /mnt
233M    /opt
0       /proc
4,0K    /root
512K    /run
7,6M    /sbin
4,0K    /srv
0       /sys
28K     /tmp
2,2G    /usr
260M    /var
3,8G    total
It has been a while since I installer Raspbian and I don't remember if I extended the filesystem to the whole Sd card so I tried to do it but it fails because of the lack of available space:

I am running Raspbian GNU/Linux 8 and already removed Wolfram, libreoffice and chromium. Any idea how to solve this without reinstalling everything?

Thanks

epoch1970
Posts: 5200
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: no more space, can't find the reason

Sat Apr 21, 2018 2:20 pm

I would try that: https://superuser.com/questions/204564/ ... an-x-bytes
on /home to find the actual files that take up space.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: no more space, can't find the reason

Sat Apr 21, 2018 3:02 pm

I don't remember if I extended the filesystem to the whole Sd card

If it was originally a 16GB card, all the space is being used.

Since May 2016 the default behaviour of Raspbian has been to extend the root filesystem to occupy all available space on first boot.

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: no more space, can't find the reason

Sat Apr 21, 2018 6:51 pm

du and df report subtly different things. From their man pages "df - report file system disk space usage" and "du - estimate file space usage" so could return differing results. I suspect that if du was not run as root it may have missed things due to file permissions.

If it's installed "ncdu" gives a browsable tree view of the file system.

Another possibility is that you have stuff in a directory that's being masked by having something mounted over it. Those won't show in "du" but will show in the figures returned by "df". Though there are no "extra" mounts indicated in the output of "df"

The safest way to troubleshoot this is with a new SD card with a stock raspbian image on it and a USB card reader:
  • Boot the new SD card.
  • Install ncdu:

    Code: Select all

    sudo apt update
    sudo apt install ncdu
  • Connect card reader and affected SD card and mount it read only e.g.

    Code: Select all

    sudo mount -o ro /dev/sda2 /mnt
  • Run ncdu:

    Code: Select all

    sudo ncdu /mnt
Another possibility for the different results in your two du commands is that one starts in "/" (du -sch /*) and the other starts in the current directory (du -sh *). Depending on which directory you were in when running "du -sh *" and its contents you will get different results.
Arguing with strangers on the internet since 1993.

Return to “Raspberry Pi OS”