projectBuilder
Posts: 3
Joined: Sun Apr 14, 2019 9:46 am

Free space problem

Sat Apr 25, 2020 6:13 am

Raspbian Stretch on a pi3 with an 8gb SD card.

Ran out of space, emptied wastebasket to get some working room. Now File Explorer shows Free Space as 1.0 GiB (Total 7.2 GiB). Suggesting some 6.2 GiB is used.

Ran ncdu to hunt down any space hogging files, but ncdu states the total disk usage is 1.3 GiB (1.2 Gi B apparent). This seems more in line with known usage of the card (i.e. not much extra installed from new).

Ran sudo fdisk –l for more info. Shows 2 devices, one of 42M FAT16, the other 7.4G Linux.

Df –h shows /dev/root sized at 7.2G, used 5.8G i.e. /dev/root is full up

Have expanded the file system using raspi-config, and rebooted, but it appears to have made no difference. On inspection, the terminal output from fdisk (following raspi-config/expand) might explain.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
I am not at all familiar with partprobe or kpartx and fear the risk of messing up my install!

Any advice on how I recover the full 8gb for use?

Thanks,
Lance

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

Re: Free space problem

Sat Apr 25, 2020 6:52 am

Which version of Raspbian did you install - Lite or Full? Full will use most of the space on a 8GB card (even on Stretch, which is old and not really supported - upgrade to Buster if you can and get a bigger card). Lite will use a lot less.

For running Raspbian Full (even without the "Recommended software" option, an 8GB card is the absolute minimum required, but that hardly leaves you any space for data.

Going back to your issue, it may be that you have old software updates using space unnecessarily. Try running sudo apt-get clean to get rid of any that are left behind.

Trying to expand the filesystem won't help. It's already as big as it can get on that card.
Unreadable squiggle

sparkyhall
Posts: 168
Joined: Mon Aug 27, 2012 9:14 am

Re: Free space problem

Sat Apr 25, 2020 7:51 am

Did you remember to tell ncdu to start at the root directory?

Code: Select all

ncdu -x /
The -x is not necessary but it stops ncdu crossing file system boundaries, for example, if you have a USB drive plugged in.

projectBuilder
Posts: 3
Joined: Sun Apr 14, 2019 9:46 am

Re: Free space problem

Sat Apr 25, 2020 9:11 am

Not sure which version installed, but expect it is "Full", not "Lite".

Entirely accept that a bigger card would be a good idea. But this installation of Raspbian has a great deal of configuration time invested in it so reluctant to move to a fresh install on a bigger card, if I can make this one work.

Utilising the ncdu -x / tip has brought new and useful results! Using it, ncdu reports disk usage of 5.7GiB. So that resolves my query about conflicting reports of free space.

That cleared up, have removed wolfram and libreoffice, freeing up space for now.

Thankyou both for the help - I was out of my depth and am grateful for being helped back to the shore!

andrum99
Posts: 1289
Joined: Fri Jul 20, 2012 2:41 pm

Re: Free space problem

Sat Apr 25, 2020 10:42 am

projectBuilder wrote:
Sat Apr 25, 2020 9:11 am
Entirely accept that a bigger card would be a good idea. But this installation of Raspbian has a great deal of configuration time invested in it so reluctant to move to a fresh install on a bigger card, if I can make this one work.
You can clone your existing SD card onto the new SD card - there is a desktop tool to do this in Raspbian. Look for 'SD Card Copier' under the 'Accessories' menu. It automatically creates a root filesystem to fill all the available space on the card (after the boot partition). You would need to add an additional SD card slot to your Pi - i.e. using a USB adaptor - since the tool requires both SD cards to be present at the same time. (For fairly obvious reasons).

An alternative, if you don't have a USB SD card adaptor, is to use another computer with an SD card slot to create an image of your existing SD card, then write this image onto the new card. You can then run raspi-config to expand the root filesystem on the new card, once it is booted on the Pi.

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

Re: Free space problem

Sat Apr 25, 2020 11:25 am

Do you have any USB drives or network shares mounted?

If there are any files/directories on the SD card below the mount point used they'll be masked by the mounted file system so ls and ncdu etc won't see them but they'll still be counted towards the total used space on the SD card.

unmount the drives/shares and recheck.
Arguing with strangers on the internet since 1993.

Return to “General discussion”