So recently, when trying to install a new package or copy a file over, I'm getting an "device out of space" kind of error.
I've tried apt-get autoremove and apt-get clean but I'm still having issues.

 df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/root           6068  5898         0 100% /
devtmpfs             213     0       213   0% /dev
tmpfs                218     0       218   0% /dev/shm
tmpfs                218    21       197  10% /run
tmpfs                  5     1         5   1% /run/lock
tmpfs                218     0       218   0% /sys/fs/cgroup
/dev/mmcblk0p6        66    22        45  32% /boot
tmpfs                 44     0        44   0% /run/user/1000  

Here's the output from fdisk -l

Disk /dev/mmcblk0: 7.4 GiB, 7985954816 bytes, 15597568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000d585c

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         8192  2496093  2487902  1.2G  e W95 FAT16 (LBA)
/dev/mmcblk0p2      2496094 15597567 13101474  6.3G  5 Extended
/dev/mmcblk0p5      2498560  2564093    65534   32M 83 Linux
/dev/mmcblk0p6      2564096  2699263   135168   66M  c W95 FAT32 (LBA)
/dev/mmcblk0p7      2703360 15597567 12894208  6.2G 83 Linux

I don't understand how these numbers add up, because this SD card is only 8 GB. Can anybody explain and also help me get some space back?


  • 1
    "df -h" is easier to read. "du" shows file space usage recursively for directories (details see manpage). – Fabian Jan 16 '18 at 2:20

You appear to be using NOOBS (and from the look a very old version). The SD Card root partition is using 1.2G - most of this would be waste space.

PS You should ALWAYS specify what OS you are using to prevent people having to guess.

sudo du -hd1 /

Will show where the space is being used. You can try other directories and/or different depths to explore more fully.

You have 6.2G on your root partition, and frankly an 8G card is inadequate for recent Raspbian, even if you weren't wasting 1.2G.

Emptying the cache (which you have done) is one of the standard fixes. You may have space in /var/log and can remove older/overlarge logs.

There is no simple fix to recover the space wasted in the NOOBS boot directory (although this is possible with another Linux machine).

If you want to continue using this installation you should consider removing unused apps. Mathematica is a particular space hog; Removing wolfram-engine will free a surprising large amount of storage.

  • The SD card came with the Pi in a package from Adafruit. It says it has NOOBS but Ive only ever booted straight into Raspbian. I thought NOOBS would boot into a menu that let me choose between different OSs. There's no good way to recover the storage taken up by the NOOBS data? – CCramer Jan 16 '18 at 3:47
  • @CCramer NOOBS comes with a Raspbian image on the card, which is presumably using most of the wasted space. If this is a new installation you would be better to wipe the card and just install Raspbian. Most of the experienced users DO NOT use NOOBS, so we can't really say much about it. Recovering the space requires another Linux system, and in reality unless you absolutely need to keep what you have it is easier to do a fresh install. – Milliways Jan 16 '18 at 3:54
  • So when I issue the command sudo du -hd1 / one of the results is a directory titled simply . and it's taking up 6.0G. If my rudimentary understanding of file systems serves me correctly here, that . is basically just pointing to the current directory, right? But..wouldn't it be redundant for this to show up if I've already asked to see a breakdown of disk usage inside the / directory? Is that supposed to be a total of all the space used by this directory? By the way, I dig your name, I've always wanted to eat there. – CCramer Jan 17 '18 at 5:16
  • @CCramer You should paste any output into your original question. Normally du does not list ., although if your working directory is / and you typed sudo du -hd1 it would show . in lieu of / (and other directories would start with ./ du always lists the TOTAL as the last entry. – Milliways Jan 17 '18 at 5:32
  • So I found that I was unable to even update due to the lack of space, so I took your advice and wiped NOOBS off my SD card and reinstalled Raspbian all by itself. Thanks – CCramer Jan 19 '18 at 5:40
  1. df is reporting all the devices, thus, on Raspberry Pi you can get the better picture of the physical block devices with:


  2. To get the sorted (ascending) list of all directory sizes try:

    sudo du / -cb|sort -n

  3. Or similarly check your home dir:

    sudo du ~ -cb|sort -n

  4. Look for unnecessary or temporary files and caches like:

    • /var/cache/apt/archives
    • /var/cache/apt/archives/partial
    • ~/.cache (for every user)
    • /var/log
    • /var/mail
    • /var/tmp
  • I'm assuming those are examples of unnecessary and temporary files; if I find any on my system, is it safe to just delete them? – CCramer Jan 16 '18 at 2:36
  • @CCramer depending what you want/need to keep. /var/cache/apt... is no longer necessary after you did some apt install ... or apt upgrade. In /var/log you can keep newest logs and delete older ones (those rotated and compressed to ...gz). Maybe some deamons/programs spam your /var/mail? – madneon Jan 16 '18 at 2:41

It appears that your root directory (/) is occupying most of the SD card and is also completely full of stuff. Perhaps you have just installed enough packages and created enough files to have used it all up, 8 GB is not a whole lot of space in modern times. It could also be an inode issue of some kind (lots of little tiny files that get an allocated block but don't use much of the allocated space).

The second 'screen' there is just showing the device and it's partitions. device -> /dev/mmcblock0 partition X -> /dev/mmcblock0pX

Your card is essentially broken down into a 1.2GB partition and a sub-divided 6.3GB partition.

You have a good sized chunk of space at the beginning of the card that is a formatted primary partition (/dev/mmcblock0p1). I would recommend mounting it somewhere temporarily to see what it is. If that's empty space you could be using it, but doing anything other than mounting it as a data partition could be difficult because it occurs before the existing data/system as opposed to after.

The rest (/dev/mmcblock0p2) is an extended (or logical) /partition containing several inner partitions which include the boot partition and the root partition.

Together they constitute ~7.5 GB which is roughly the formatted size of the card.

  • Ok, thanks for your help. How would I go about mounting that partition to see what it is? After doing so, would I then need to unmount it again? I've only owned this Pi for like 2 weeks, and I'm pretty sure I've only installed, maybe nmap and wireshark? What's the quickest way to get a look at packages I've installed myself, instead of packages that came with Raspbian? – CCramer Jan 16 '18 at 0:35
  • You would mount a filesystem using the 'mount' command. Here's some documentation -> man7.org/linux/man-pages/man8/mount.8.html You may prefer to check 'man mount' to make sure you get suitable instructions for the version that's part of Raspbian. ---- First make a directory somewhere (using 'mkdir') then use the mount command. It should get unmounted and left that way after a reboot since it's not in /etc/fstab (filesystem table?) which is how the system knows what to mount at boot. – Jeremy Harton Jan 16 '18 at 0:40
  • I'm not sure how you would be able to tell the difference between "who" installed the packages. The answers to this stackoverflow question may be of use: superuser.com/questions/48374/find-all-user-installed-packages You can hunt for a useful apt related tool or try to dig around in the log files to see what was installed and when. – Jeremy Harton Jan 16 '18 at 0:46

Have a look into /var/log - is there some logfile constantly growing due to some continuous checking? I had that with a nowadays rarely used demon rinetd, which created gigabytes of logs, due to some misconfiguration.

  • I looked into this directory, and there were quite a few items inside, but I have no idea if any of them are important or not. I tried using du to see how much space they were all taking up, but that only showed me the size of directories, not the size of files inside this directory. – CCramer Jan 17 '18 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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