Raspberry Pi - Stalled Camera Process and Out of Disk Space
March 13, 2020
Procrastination fail! The day before yesterday my raspberry pi finally ran out of disk space in the middle of taking the day’s time lapse photos. I never got around to automating the transfer of raw files off of the pi itself. Here’s how I got it working again.
Check Disk Space
To confirm the hard disk was actually full:
$ df -H |
/dev/root
is the main file system to pay attention to, and it’s clearly 100% full.
Remove Files
For an immediate quick fix I did this manually to start. I went back to my old notes and used the scp
command to copy files to my laptop. Then I manually uploaded them to AWS S3 buckets, confirmed the transfer, and then deleted the files off of the pi.
With a lot of files, this was a long process, and I still need to set it up to move the files from the pi to AWS without needing my laptop in the middle.
Test Camera
With more space available, I tested the camera to make sure it would be ready to go for the next day’s photo taking:
$ raspistill -o Desktop/image.jpg |
Yikes, problem!
Some googling hinted that this error may come up if another process is using raspistill
in the background.
Another hint: in the latest folder of time lapse photos, there was an empty file container (file name was along the lines of timelapse-2020-03-11-0090.jpg~
) which must have been created just as the disk ran out of space. I deleted this non-file, but it indicated that the script may still be running in the background if it was interrupted like this.
I tried resetting the camera unit via sudo raspi-config
but this did not make it work.
This Q&A suggested some other troubleshooting methods, but updating the firmware or reinstalling Raspbian from scratch seemed like overkill.
It did give one hint though, a command to see what raspistill
was doing in the background:
$ sudo ps aux|grep raspi |
The second process was referenced in the Q&A as the normal output. This first process though (21373
) is clearly my time lapse command…one which should have ended at the end of the day on the 11th, but was clearly still hung up!
So I killed the process:
$ sudo kill 21373 |
And tested the camera again:
$ raspistill -o Desktop/image.jpg |
SUCCESS!