graysky2 / anything-sync-daemon

Symlinks and syncs user specified dirs to RAM thus reducing HDD/SDD calls and speeding-up the system.
https://wiki.archlinux.org/index.php/Anything-sync-daemon
MIT License
345 stars 45 forks source link

Unable to restore from backup #82

Open shankargopal opened 1 year ago

shankargopal commented 1 year ago

Thank you for this wonderful program!

I am running asd to sync the config directory of Franz. This is ~/.config/Franz. My laptop frequently crashes from low battery (it's an old laptop :) ) and I've had asd and profile-sync-daemon recover well a few times. This time I may have opened Franz too early, when it was still recovering. The result is that now the Franz profile seems to be bad.

I followed the instructions in the wiki to manually restore a snapshot. In my case I run:

sudo systemctl stop asd
ls ~/.config

There is a directory Franz and a few snapshots. Following the instructions in the wiki, I do the following:

cd .config
mv Franz Franz-bad
tar -xvf <snapshot file>

When I then run sudo systemctl start asd, it fails. The error is that it cannot find /home/{USERNAME}/.config/Franz.

Now what should I do? If I create a blank directory named Franz, the application starts as if it is starting with a blank profile. If I keep this and then try restoring from snapshot again, after stopping asd, I get a mixed up state.

How do I restore from the snapshots saved on my system? It seems like the instructions don't work?

manorit2001 commented 1 year ago

Hi, ideally the snapshot file should have the last state that was working for it, since the time to take backup is actually long there can be cases of corruption like in your case ( when you opened Franz while it was still taking backup ), i've tried to think of some way to avoid it ( and minimise as much as possible ) but keeping the idealogy of less HDD writes actually makes it a bit difficult to implement, there will always be tradeoff for this scenario.

If any of your snapshot files ain't working then am not very hopeful that you might get your data back, might be a good idea to only use this for non important stuff as the working of backups is still a difficult thing to implement. Will think of some way to avoid it

shankargopal commented 1 year ago

I understand. But in this case it doesn't seem clear what i should do with ~/.config/Franz when trying to restore. If I do mv Franz Franz-bad as per the wiki instructions, asd refuses to start. So how should I handle that?

On 24 January 2023 10:16:03 pm IST, Manorit Chawdhry @.***> wrote:

Hi, ideally the snapshot file should have the last state that was working for it, since the time to take backup is actually long there can be cases of corruption like in your case ( when you opened Franz while it was still taking backup ), i've tried to think of some way to avoid it ( and minimise as much as possible ) but keeping the idealogy of less HDD writes actually makes it a bit difficult to implement, there will always be tradeoff for this scenario.

If any of your snapshot files ain't working then am not very hopeful that you might get your data back, might be a good idea to only use this for non important stuff as the working of backups is still a difficult thing to implement. Will think of some way to avoid it

-- Reply to this email directly or view it on GitHub: https://github.com/graysky2/anything-sync-daemon/issues/82#issuecomment-1402257217 You are receiving this because you authored the thread.

Message ID: @.***>

manorit2001 commented 1 year ago

Hi, the wiki is actually old. With the current update the backup directory will actually be in place itself and you won't need to do anything, just to keep the state of backup directory we take those compressed backups. You need not move anything. The Franz directory that you have is the one that you require.

shankargopal commented 1 year ago

Thank you! But does that mean there's no way to manually restore an older snapshot?

On Wed, Jan 25, 2023 at 8:53 AM Manorit Chawdhry @.***> wrote:

Hi, the wiki is actually old. With the current update the backup directory will actually be in place itself and you won't need to do anything, just to keep the state of backup directory we take those compressed backups. You need not move anything. The Franz directory that you have is the one that you require.

— Reply to this email directly, view it on GitHub https://github.com/graysky2/anything-sync-daemon/issues/82#issuecomment-1403046999, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK4C6ORM5EAF7FN2M2VUELWUCMC3ANCNFSM6AAAAAAUFIJMMI . You are receiving this because you authored the thread.Message ID: @.***>

manorit2001 commented 1 year ago

So if you keep the backups enabled, what is does it it takes the state at which the current directory is and makes a compressed tar of that folder incase of an abrupt power down, but this happens when the computer next boots up. So essentially whatever folder you had should had been backed up in that tar file ( asd p should show you the backup files ) which when uncompressed should give you the output directory that you want.

It's not required after the new version change anymore but is just a failsafe trying to keep atleast some data before any furthur corruption by some other program that might use the folder after the abrupt power down.

shankargopal commented 1 year ago

Ok. I did try the following:

[closed Franz]
sudo systemctl stop asd
cd ~/.config
rm -rf Franz
tar -xvf <snapshot>
mv .Franz-backup_asd-old Franz
sudo systemctl start asd
[restart Franz]

And it still came up in an inconsistent state. But this may be because of some caching issue as well - I did not restore the cache which also was under asd syncing, my bad.

I could try with that, but I've now decided I don't want to potentially risk messing up the integrity of the original messaging client - not sure if that is possible - so I think I'll just let it go for now.

I just wanted to check if the above is done right, as per what you said? If so perhaps I can submit a PR for the README so that the instructions can be updated? Of course would make the instructions generic (i.e. using foo bar instead of Franz).