RPI2 - No space left on device

Hi
I use a raspberry pi 2 with a 3TB HDD USB and 16G SD.
I installed ProFTP, BitTorrent, Kodi and MiniDLNA and I am using them from about one mounth without issues.

Now, BitTorrent does not work correctly because of

Error: Unable to save resume file: No space left on device

I ran ‘df’ command and I found that /dev/root is 100% used.
I ran ‘du’ command under root directory to undestand which are the files filling space but the only ones present are kodi files and they fill just 159M.
I also updated dietpi from 142 to 143 rev without any advantage.

How is it possible?

Can you help me to solve this mystery?
Thanks

Francesco

Hi,

Possible data meant for USB drive has been stored on SD card. This can occur if the USB drive is not mounted during boot (can happen, especially with RPi).

Lets check current filesystems. Please take you take a picture/screenshot of the following commands:

df -h
blkid

Lets check userdata location:

readlink -f /mnt/dietpi_userdata

Now lets check if any user data is stored on SD:

dietpi-services stop
umount /mnt/usb_1
ls -lha /mnt/usb_1

If the drive fails to unmount, delete all pending transmission downloads, power off system, unplug USB drive, power on. Then run:

ls -lha /mnt/usb_1

Hi,

thanks for the quick reply.

I followed the steps that you’ve shown me (see attached file Immagine.jpg).

I also deleted all pending transmission downloads and unpluged USB drive.

But when I power on, RPI generates the error showed in attached immagine2.jpg
Note that this issue is very similar to that I wrote to you in my previous thread (see RPI2 - Failed to start LSB).


Is this when the drive is plugged in?

It looks like RootFS is filled, I believe due to USB drive not being mounted during a boot, transmission downloads then stored on SD.

You need to psyhically remove the USB drive from system, power on, then run following to free up the space:

rm -R /mnt/usb_1/*

If you do the above with USB drive attached, you’ll lose all your data on USB drive, so please check.

As for a prevention:
DietPi adds rootdelay=10 to /boot/cmdline.txt as a workaround for this known issue. Although, some drives may still not be detected during each boot. You could try increasing this value.
This is a problem with the RPi itself.

I accurately followed the steps that you’ve shown me, so the error is when I powered on the system without USB drive (psyhically removed from system).
Any way, despite the error, I tried to run

rm -R /mnt/usb_1/*

in a putty window but RPI remains as if it were frozen (I have to use Ctrl C to have the cursor back again) see immagine3.jpg

After this, when I reboot the system always without USB drive plugged in, I always have the error showed to you in immagine2.jpg

I do not know if it is important but there is not any /var/swap directory on my RPI. swap file is on USB drive.

Ok, we’ll need to disable the mount entry for this drive, SystemD is waiting for the drive to become available and will hang those commands.

  • Edit fstab:
nano /etc/fstab
  • Comment out the line with /mnt/usb_1, eg:
#/dev/sda1       /mnt/usb_1      auto     defaults,noatime,nofail,x-systemd.automount  0 0
  • Save and exit (ctrl+x, y, enter)
  • Reload systemd
systemctl daemon-reload
  • reboot

Now you should be able to run these commands successfully, to remove the data on SD card. Make sure USB drive is not attached:

df -h
rm -R /mnt/usb_1/*
df -h

Onces thats done, you’ll need to renable the /etc/fstab mount entry again. Simply repeat steps above and uncomment the /mnt/usb_1 entry, eg:

/dev/sda1       /mnt/usb_1      auto     defaults,noatime,nofail,x-systemd.automount  0 0

Edit fstab:

Code: Select all
nano /etc/fstab


Comment out the line with /mnt/usb_1, eg:

Code: Select all
#/dev/sda1 /mnt/usb_1 auto defaults,noatime,nofail,x-systemd.automount 0 0


Save and exit (ctrl+x, y, enter)

When I opened fstab I found what you can see in attached immagine4.jpg

I commented the line showed by red arrow.

But the issue came when I tried to save, because of a message indicating not enough space on device.
I closed it and when I opened fstab again, I found it empty, no lines inside. :open_mouth:
I tried to rewrite the line, coping them from the attached file, but it was impossible to save because of not enough space again.

I rebooted hoping to free space on device but it was worse because now booting errors increased, there is a login error (see immagine5 and immagine6) and I have no write permission (despite I use ‘sudo nano /etc/ftab’). Furthermore, putty does not work anymore.

At this point, I think I’m entered in quicksand so I believe it might be better to reinstall. Do you agree?
Or do you have other cartridges to be shot?



Immagine6.jpg

But the issue came when I tried to save, because of a message indicating not enough space on device.

Very unlucky :frowning:

Yep, think thats the best solution. We could try and recover, but it could take a long time, and, no guarantee of result.

francescoG wrote:
At this point, I think I’m entered in quicksand so I believe it might be better to reinstall. Do you agree?


Yep, think thats the best solution. We could try and recover, but it could take a long time, and, no guarantee of result.

I’ll reinstall. :cry:
Anyway, thanks so much for the time you have dedicated to solve my iusses.
I have just another more questions:
which is the path of swap file?



/var/swap

If you setup a USB drive, during 1st run, it will be moved automatically to USB drive.

You can check current size and location with:

/DietPi/dietpi/func/dietpi-set_dphys-swapfile

I may have figured out why of no space left on device.
I reinstalled dietpi.
Using ‘df’ command, I have observed that the space filling is caused by:

  • Kodi: Without Kodi the used space is about 7%. Kodi needs about 8% of /dev/root space to store updated basic ADD ONs. I have about 1 TB of files stored in my USB drive. Before updating the kodi information of these files, /dev/root used space was 15%. After the used space increased to 90%.
  • BitTorrent: Although the files are correctly written in the download folder of USB drive, some bytes are also written in the /dev/root which causes a very slow space filling (200/300 bytes/GB at a time increases during download).

Have you never seen such a thing?
Could a solution be to configure kodi (more important) and bitTorrent (lees important) to store their information in the USB drive rather than in SD?
Do you think it’s possible? And how to?

P.S.: I put rootdelay=50

Can you give me more insight into your findings?
Transmission stores everything in memory cache (RAM), once full, or completed, it then writes/reads directly to user data location (eg: USB drive):

/mnt/dietpi_userdata/downloads



  • Kodi: Without Kodi the used space is about 7%. Kodi needs about 8% of /dev/root space to store updated basic ADD ONs. I have about 1 TB of files stored in my USB drive. Before updating the kodi information of these files, /dev/root used space was 15%. After the used space increased to 90%.

Must be database + metadata.

Lets check its size with:

du -hcs /root/.kodi