Introduction:
To make sure my RasPi has the longest possible live duration, i've enabled read-only boot partition as well as the overlay filesystem.
I want to save the fake-hwclock.data
(current system time) to a mounted USB, so that when the machine reboots, it starts on the "current" time (last time before reboot) and not the time from before the overlay filesystem got enabled.
To make sure that important logs are saved too, these are written to the USB too.
So before I enabled the overlay fs i did the following steps:
Mount USB Stick
PARTUUID=a633bb72-9ab7-c643-96c2-5817177752ef /mnt/storage ext4 defaults,noatime 0 0
Create Symlink to file on mounted USB Stick
sudo rm /etc/fake-hwclock.data
sudo ln -s /mnt/storage/fake-hwclock.data /etc/fake-hwclock.data
Check if symlink got created
ls -ln /etc/fake-hwclock.data
which returns:
lrwxrwxrwx 1 0 0 30 Feb 7 15:06 /etc/fake-hwclock.data -> /mnt/storage/fake-hwclock.data
Problem Statement:
The problem is, the logs are getting saved, as well as the time in fake-hwclock.data
but when the machine reboots, the time is still set to the time before the overlay filesystem got enabled.
I think it's reading the data from /etc/fake-hwclock.data
(which gets reset at reboot) instead of /mnt/storage/fake-hwclock.data
.
I can't see what i am missing. I tried to modify /sbin/fake-hwclock
file (which is responsible for reading/saving data to /etc/fake-hwclock.data
) to save/read the data directly to/from /mnt/storage/fake-hwclock.data
- this hasn't changed anything though.
- Why is the time on my USB reset as soon as i reboot? (Or rather, why does it still take the time from
/etc/fake-hwclock.data
- Is
/etc/fake-hwclock.data
not the only file where the time is saved? Because i can't find any other file - Does Raspbian read the time from somewhere else than
/etc/fake-hwclock
?