Is my SD card full on my raspberry pi?

It would seem I can’t write to my SD card, or move / delete files. Is this a symptom of the card being full? I am trying to rebuild my config file due to an unrelated issue (or maybe not?), here’s terminal output:

pi@raspberrypi:/home $ cp homeassistant/.homeassistant/configuration.yaml pi/.homeassistant
cp: error writing ‘pi/.homeassistant/configuration.yaml’: No space left on device
cp: failed to extend ‘pi/.homeassistant/configuration.yaml’: No space left on device
pi@raspberrypi:/home $ 

I’ve heard of this happening- short of reinstalling on another SD, how might I remedy this?

edit after reinstalling default config file I get the following errors on the frontend, which also points to storage being full

Have a look at the contents of the homeassistant/.homeassistant folder.

`ls -lh
That will show the files and their sizes. Assuming that your home-assistant_v2.log file has consumed the space you can shut down ha and delete it. It will be recreated when you restart ha. You will loose past history and logbook entries but no harm.

Ok, thank you!

I’ll probably try to save the logs for now

Unless you make use of history, it is totally unimportant.

are you referring to

home/pi/.homeassistant/home-assistant_v2.db

or

homeassistant/.homeassistant/home-assistant_v2.db

the .db file in the pi folder is 350 MB, the rest aren’t larger than a few hundred bytes.
I can’t find home-assistant_v2.log

edit maybe this is more useful

pi@raspberrypi:/home/homeassistant $ sudo du ./ -h --max-depth=1
25M	./.cache
20M	./.homeassistant
572K	./.pip
45M	./
pi@raspberrypi:/home/homeassistant $ cd 
pi@raspberrypi:~ $ cd ..
pi@raspberrypi:/home $ ls
homeassistant  pi
pi@raspberrypi:/home $ cd pi
pi@raspberrypi:~ $ sudo du ./ -h --max-depth=1
25M	./.cache
368M	./.homeassistant
393M	./
pi@raspberrypi:~ $  

more thoroughly these are homeassistant folder file sizes (there is probably a better way to do this, could notget you command to work though):

pi@raspberrypi:/home/homeassistant $ `ls -lh
> ^C
pi@raspberrypi:/home/homeassistant $ ls -lh
total 0
pi@raspberrypi:/home/homeassistant $ du -h
du: cannot read directory ‘./.cache’: Permission denied
4.0K	./.cache
36K	./.homeassistant/deps/Werkzeug-0.11.11.dist-info
48K	./.homeassistant/deps/CherryPy-8.1.0.dist-info
40K	./.homeassistant/deps/static3-0.7.0.egg-info
8.0K	./.homeassistant/deps/pytz/zoneinfo/Arctic
56K	./.homeassistant/deps/pytz/zoneinfo/US
176K	./.homeassistant/deps/pytz/zoneinfo/Pacific
36K	./.homeassistant/deps/pytz/zoneinfo/America/Indiana
12K	./.homeassistant/deps/pytz/zoneinfo/America/Kentucky
56K	./.homeassistant/deps/pytz/zoneinfo/America/Argentina
16K	./.homeassistant/deps/pytz/zoneinfo/America/North_Dakota
680K	./.homeassistant/deps/pytz/zoneinfo/America
40K	./.homeassistant/deps/pytz/zoneinfo/Canada
384K	./.homeassistant/deps/pytz/zoneinfo/Asia
52K	./.homeassistant/deps/pytz/zoneinfo/Antarctica
144K	./.homeassistant/deps/pytz/zoneinfo/Etc
48K	./.homeassistant/deps/pytz/zoneinfo/Indian
220K	./.homeassistant/deps/pytz/zoneinfo/Africa
12K	./.homeassistant/deps/pytz/zoneinfo/Chile
16K	./.homeassistant/deps/pytz/zoneinfo/Mexico
96K	./.homeassistant/deps/pytz/zoneinfo/Australia
20K	./.homeassistant/deps/pytz/zoneinfo/Brazil
252K	./.homeassistant/deps/pytz/zoneinfo/Europe
52K	./.homeassistant/deps/pytz/zoneinfo/Atlantic
2.5M	./.homeassistant/deps/pytz/zoneinfo
76K	./.homeassistant/deps/pytz/__pycache__
2.6M	./.homeassistant/deps/pytz
28K	./.homeassistant/deps/enum_compat-0.0.2.egg-info
32K	./.homeassistant/deps/six-1.10.0.dist-info
116K	./.homeassistant/deps/pytz-2016.6.1.dist-info
76K	./.homeassistant/deps/fuzzywuzzy-0.12.0.dist-info
36K	./.homeassistant/deps/netifaces-0.10.5.egg-info
36K	./.homeassistant/deps/netdisco-0.7.1.dist-info
244K	./.homeassistant/deps/cherrypy/lib/__pycache__
504K	./.homeassistant/deps/cherrypy/lib
48K	./.homeassistant/deps/cherrypy/tutorial/__pycache__
96K	./.homeassistant/deps/cherrypy/tutorial
8.0K	./.homeassistant/deps/cherrypy/scaffold/__pycache__
16K	./.homeassistant/deps/cherrypy/scaffold
528K	./.homeassistant/deps/cherrypy/test/__pycache__
1.1M	./.homeassistant/deps/cherrypy/test
76K	./.homeassistant/deps/cherrypy/wsgiserver/__pycache__
176K	./.homeassistant/deps/cherrypy/wsgiserver
264K	./.homeassistant/deps/cherrypy/__pycache__
72K	./.homeassistant/deps/cherrypy/process/__pycache__
152K	./.homeassistant/deps/cherrypy/process
2.6M	./.homeassistant/deps/cherrypy
116K	./.homeassistant/deps/requests-2.11.1.dist-info
24K	./.homeassistant/deps/paho_mqtt-1.2.egg-info
40K	./.homeassistant/deps/fuzzywuzzy/__pycache__
84K	./.homeassistant/deps/fuzzywuzzy
24K	./.homeassistant/deps/xmltodict-0.10.2.egg-info
116K	./.homeassistant/deps/paho/mqtt/__pycache__
260K	./.homeassistant/deps/paho/mqtt
8.0K	./.homeassistant/deps/paho/__pycache__
272K	./.homeassistant/deps/paho
48K	./.homeassistant/deps/zeroconf-0.17.6.dist-info
32K	./.homeassistant/deps/astral-1.2.dist-info
176K	./.homeassistant/deps/sqlalchemy/dialects/mysql/__pycache__
352K	./.homeassistant/deps/sqlalchemy/dialects/mysql
84K	./.homeassistant/deps/sqlalchemy/dialects/sqlite/__pycache__
172K	./.homeassistant/deps/sqlalchemy/dialects/sqlite
108K	./.homeassistant/deps/sqlalchemy/dialects/oracle/__pycache__
220K	./.homeassistant/deps/sqlalchemy/dialects/oracle
48K	./.homeassistant/deps/sqlalchemy/dialects/sybase/__pycache__
100K	./.homeassistant/deps/sqlalchemy/dialects/sybase
116K	./.homeassistant/deps/sqlalchemy/dialects/mssql/__pycache__
228K	./.homeassistant/deps/sqlalchemy/dialects/mssql
52K	./.homeassistant/deps/sqlalchemy/dialects/firebird/__pycache__
104K	./.homeassistant/deps/sqlalchemy/dialects/firebird
204K	./.homeassistant/deps/sqlalchemy/dialects/postgresql/__pycache__
404K	./.homeassistant/deps/sqlalchemy/dialects/postgresql
12K	./.homeassistant/deps/sqlalchemy/dialects/__pycache__
1.6M	./.homeassistant/deps/sqlalchemy/dialects
820K	./.homeassistant/deps/sqlalchemy/sql/__pycache__
1.7M	./.homeassistant/deps/sqlalchemy/sql
264K	./.homeassistant/deps/sqlalchemy/engine/__pycache__
548K	./.homeassistant/deps/sqlalchemy/engine
8.0K	./.homeassistant/deps/sqlalchemy/databases/__pycache__
16K	./.homeassistant/deps/sqlalchemy/databases
40K	./.homeassistant/deps/sqlalchemy/testing/plugin/__pycache__
80K	./.homeassistant/deps/sqlalchemy/testing/plugin
100K	./.homeassistant/deps/sqlalchemy/testing/suite/__pycache__
196K	./.homeassistant/deps/sqlalchemy/testing/suite
188K	./.homeassistant/deps/sqlalchemy/testing/__pycache__
636K	./.homeassistant/deps/sqlalchemy/testing
1.1M	./.homeassistant/deps/sqlalchemy/orm/__pycache__
2.2M	./.homeassistant/deps/sqlalchemy/orm
60K	./.homeassistant/deps/sqlalchemy/event/__pycache__
116K	./.homeassistant/deps/sqlalchemy/event
28K	./.homeassistant/deps/sqlalchemy/connectors/__pycache__
56K	./.homeassistant/deps/sqlalchemy/connectors
120K	./.homeassistant/deps/sqlalchemy/util/__pycache__
228K	./.homeassistant/deps/sqlalchemy/util
64K	./.homeassistant/deps/sqlalchemy/ext/declarative/__pycache__
136K	./.homeassistant/deps/sqlalchemy/ext/declarative
224K	./.homeassistant/deps/sqlalchemy/ext/__pycache__
588K	./.homeassistant/deps/sqlalchemy/ext
160K	./.homeassistant/deps/sqlalchemy/__pycache__
8.0M	./.homeassistant/deps/sqlalchemy
84K	./.homeassistant/deps/netdisco/discoverables/__pycache__
168K	./.homeassistant/deps/netdisco/discoverables
64K	./.homeassistant/deps/netdisco/__pycache__
284K	./.homeassistant/deps/netdisco
732K	./.homeassistant/deps/requests/packages/chardet/__pycache__
1.3M	./.homeassistant/deps/requests/packages/chardet
12K	./.homeassistant/deps/requests/packages/urllib3/packages/ssl_match_hostname/__pycache__
24K	./.homeassistant/deps/requests/packages/urllib3/packages/ssl_match_hostname
48K	./.homeassistant/deps/requests/packages/urllib3/packages/__pycache__
124K	./.homeassistant/deps/requests/packages/urllib3/packages
40K	./.homeassistant/deps/requests/packages/urllib3/contrib/__pycache__
80K	./.homeassistant/deps/requests/packages/urllib3/contrib
64K	./.homeassistant/deps/requests/packages/urllib3/util/__pycache__
132K	./.homeassistant/deps/requests/packages/urllib3/util
116K	./.homeassistant/deps/requests/packages/urllib3/__pycache__
584K	./.homeassistant/deps/requests/packages/urllib3
8.0K	./.homeassistant/deps/requests/packages/__pycache__
1.9M	./.homeassistant/deps/requests/packages
164K	./.homeassistant/deps/requests/__pycache__
2.5M	./.homeassistant/deps/requests
164K	./.homeassistant/deps/werkzeug/contrib/__pycache__
324K	./.homeassistant/deps/werkzeug/contrib
212K	./.homeassistant/deps/werkzeug/debug/shared
60K	./.homeassistant/deps/werkzeug/debug/__pycache__
336K	./.homeassistant/deps/werkzeug/debug
596K	./.homeassistant/deps/werkzeug/__pycache__
1.9M	./.homeassistant/deps/werkzeug
68K	./.homeassistant/deps/SQLAlchemy-1.0.15.egg-info
212K	./.homeassistant/deps/__pycache__
20M	./.homeassistant/deps
20M	./.homeassistant
572K	./.pip
21M	.

What does df -h show? Then, what does df -i show?

pi@raspberrypi:/home/homeassistant $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G   29G     0 100% /
devtmpfs        427M     0  427M   0% /dev
tmpfs           432M     0  432M   0% /dev/shm
tmpfs           432M  5.9M  426M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           432M     0  432M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M   43M  33% /boot


pi@raspberrypi:/home/homeassistant $ df -i
Filesystem      Inodes IUsed   IFree IUse% Mounted on
/dev/root      1870848 50107 1820741    3% /
devtmpfs        109264   354  108910    1% /dev
tmpfs           110347     1  110346    1% /dev/shm
tmpfs           110347   439  109908    1% /run
tmpfs           110347     4  110343    1% /run/lock
tmpfs           110347    10  110337    1% /sys/fs/cgroup
/dev/mmcblk0p1       0     0       0     - /boot

so…/dev/root is either a big issue or not at all, I’m too much of a noob to discern which one

Looks like var/log is the culprit?

pi@raspberrypi:~ $  sudo du -k /var | sort -n -r | head
28456988	/var
28147784	/var/log
122976	/var/cache
118040	/var/cache/apt
82480	/var/lib
74260	/var/cache/apt/archives
50544	/var/lib/apt
50500	/var/lib/apt/lists
17328	/var/lib/dpkg
16284	/var/lib/dpkg/info

You can delete old logfiles in var log. Anything that has been gzipped is fair game. Depending on what the sizes are for contents of /var/log you can consider changing how logrotate handles logfiles. Take a look at /etc/logrotate.conf

does that include all .gz files in all subdirectories? i.e.:

find . -name "*.gz" -type f -delete

I personally would leave off the delete and see what shows up first. Have a look, and then run it again with the delete flag. Any log that has been gzipped should be fine. I just like to see what they are and relative sizes. If I have log files that are large and have just started growing, it might be an indication of something to look into.

Make sure you start in the /var/log directory

definitely!

this is what it dumps. but I don’t think any of these are big.

pi@raspberrypi:/var/log $ find -type f -iname '*.gz'
./syslog.4.gz
./syslog.3.gz
./dpkg.log.3.gz
./debug.4.gz
./auth.log.3.gz
./syslog.7.gz
./daemon.log.3.gz
./daemon.log.4.gz
./kern.log.2.gz
./dpkg.log.2.gz
./messages.3.gz
./tor/log.4.gz
./tor/log.2.gz
./tor/log.3.gz
./tor/log.6.gz
./tor/log.5.gz
./apt/term.log.2.gz
./apt/term.log.1.gz
./apt/history.log.1.gz
./apt/term.log.3.gz
./apt/history.log.2.gz
./apt/history.log.3.gz
./debug.2.gz
./messages.2.gz
./auth.log.4.gz
./syslog.5.gz
./mosquitto/mosquitto.log.5.gz
./mosquitto/mosquitto.log.2.gz
./mosquitto/mosquitto.log.1.gz
./mosquitto/mosquitto.log.4.gz
./mosquitto/mosquitto.log.7.gz
./mosquitto/mosquitto.log.6.gz
./mosquitto/mosquitto.log.3.gz
./debug.3.gz
./kern.log.4.gz
./daemon.log.2.gz
./syslog.2.gz
./auth.log.2.gz
./kern.log.3.gz
./syslog.6.gz
./messages.4.gz

looking in var/log, daemon.log and syslog.1 are both about 14.5 gigs…

Just delete syslog.1 it is old. daemon.log should be rotated but once you have removed syslog.1 you will have room.

thank you. I should leave daemon.log alone I presume. what do you mean by rotated? I should head over to /etc/logrotate.conf and learn? thank you for your help, man.

Those logs should not be that large. Either is something wrong that there is so much written to them or they aren’t rotated often enough. logrotate will use the information in it’s conf file to determine when to swap in a new file, compress the old and delete the oldest. This isn’t a corporate server in a hostile environment so you don’t need lots of log files to pour over looking for bad stuff. They are helpful for tracking down errors but you don’t need lots of history. You can change the weekly to daily and save 2 ???

2 Likes

Depending on your platform, you may need to make changes in /var/logrotate.d/rsyslog or syslog

Ok. How might I go about determining that?
I’m running home assistant in a virtual environment in a raspbian jessie lite install

Also, this site keeps crashing on me: https://www.dropbox.com/s/h35msppqnm6igki/Screenshot%202017-08-09%2016.27.51.png?dl=0

I highly recommend moving away from a SDcard any dump your image onto a USB thumb drive, if on a Pi 3.