Why are folders being randomly deleted?

Hello there,

It has happened to me on several occasions that my Downloads folder has been deleted. This is, of course, a bummer, but nothing of big significance, as my Downloads folder is just stuff without a meaning to me. However, about an hour ago, my Documents folder containing several very important files has randomly vanished. The moment when it vanished I was in my terminal and changed from my Documents folder to my home folder using the cd command. I can confirm that I did not move or remove the folder via a command (mv, rm etc.). However I did move files within the directory.

It simply vanished out of existence after I hit the cd command. After my Downloads folder disappeared the first time, I dreaded this moment and set up Deja Dup as my backup solution, however, as it turns out, it did not back up the Documents folder as I set it up to do, leaving me lost without my important work.

I use an HDD, and a SMARTctl check told me that it passed the SMART overall-health self-assessment test, which I indicate to be a sign that the hard drive is functioning and healthy.

A bit more information about my system: I use openSUSE Tumbleweed x64 on the latest snapshot with a btrfs partition on both / and /home.

Is there some way to get the folder back, or at least make sure it won’t happen again in the future?

Thanks a lot.

Unmount /home right now and remove it from fstab. If it fails you may have to do log off and switch to a tt.

Create a /home subvolume in the partition for /:

sudo btrfs subvolume create /home
sudo mkdir -p "$HOME"

or, if it can’t create a subvolume there, just:

sudo btrfs subvolume create "$HOME"

Make you the owner:

sudo chown $USER:users "$HOME"

At least you would have a working system and the /home partition preserved as much as possible.

The next step is using a tool to recover data. Checkout https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-restore from btrfs-progs, and this script: btrfs-undelete · GitHub (review is required before attempting to run it).

The question about it happening again. You noticed the directory went away on cd but I guess it may have gone already at that point. Look in the journal if there’s something suspicious:

sudo journalctl --since="2020-05-27 00:00:00"

To make recovery easier, I’d enable snapshots on /home, and make periodic btrfs send/receive to a btrfs fs on external media: Incremental Backup - btrfs Wiki .

Do you recall which TW snapshot do you used to install the system?

Hey,
my installation snapshot was 20200407, I think.

Also I tried doing what you said, but the btrfs-undelete program found nothing.