I can create files and programs, but when I power cycle the Pi, all the new content is gone. I have tried to edit an existing file. The changes were gone after the power cycle. File manager shows 2.4G free. Any thought?
I can create files and programs, but when I power cycle the Pi, all the new content is gone. I have tried to edit an existing file. The changes were gone after the power cycle. File manager shows 2.4G free. Any thought?
Enter the following commands and post output here:
df -h
uname -r
Thanks, Clem
pi@raspberrypib:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 4.4G 2.5G 64% /
devtmpfs 427M 0 427M 0% /dev
tmpfs 432M 0 432M 0% /dev/shm
tmpfs 432M 12M 420M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 432M 0 432M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 87M 0 87M 0% /run/user/1000
/dev/sda1 247M 552K 247M 1% /media/pi/USB DISK
pi@raspberrypib:~ $ uname -r
4.1.19-v7+
pi@raspberrypib:~ $
Check and see if the partitions are mounted read only for some reason. Use the command "mount" (minus the quote marks) and look for (ro) at the end of any of the lines in the output.
GNU/Linux first writes files to RAM buffers and later writes them to non-volatile storage like an SD card or Flash drive. If you hard reset or power down before the files are written to non-volatile storage, you'll lose the changes.
Use the "sync" command write changes to non-volatile storage immediately. Enter "man sync" in a terminal window for more information.
Use the "shutdown" command before turning off power. If you're using a GUI, there should be a power down command somewhere to shut down safely.
The very last line has '...flash,errors=remount-ro,...'.
I don't see any errors.
I do use the GUI shutdown before power down. I wait until the touch screen goes to just lines, then pull the power.
I tried the 'sync' commend. Same result, all changes lost. The files revert to a mid Jan 2016 version. Luckily I have a habit of saving copies to a USB drive.
I am considering formatting and reloading Jessie to the SD card.
IF the system would remount your file system read only (due to an error), the write that triggered it has already returned and it is impossible for the system to retroactively forward the error to the application.
But all subsequent writes to a readonly mounted file system would fail immediately and you'd get errors.
The behavior that you describe sounds like the wanted behavior for a guest account. Could it be that your account is flagged as a guest account? (I'm not familiar how guest accounts work at the lower level so I'm not even sure that it is possible to tag a normal account as a guest account).
It sounds like that for some reason at least one partition is being mounted read-only. Without the full output of the command it is difficult to diagnose further. Try running "dmesg" and look for errors there, also look in /var/log/messages for any error messages.
---Edit---
This is not the issue, as Roger Wolff pointed out, if the file system went read-only your process should throw an error and your editor would not let you save the file
Again... The process triggering the error would not be getting an error. But all subsequent writes would immediately fail with read-only file system.
I created a test read-only filesystem. When I edit a file with nano I get the following status message:
[ Warning: Modifying a file which is not locked, check directory permission? ]
Then when I try to exit and save the file, I get:
[ Error writing test.txt: Read-only file system ]
and nano refuses to exit. If your home dir would remount readonly due to errors you'd notice it.
Good point. I have seen file systems go read only that didn't impact home directories. It depends on the layout of the SD card, then again, on a Pi it is probably just one big file system on the SD card. I was thinking in the mind set of a large hard drive with separate partitions for home, boot, var, etc, and should have looked closer at his df output.