Problem with correctly mounting BTRFS on an internal drive of TO after power outages

Hello all,

I need some help please. Chronologically this was what happened:

  1. Mains electrical fault caused power outages, and Turris Omnia (TO) lost power;
  2. A little while later, power resumed
  3. Because the cause of the electrical fault wasn’t rectified, a few seconds into power resumption, power was lost again, hence back to Step 1.

The above happened a few times until the cause was rectified. This was last weekend around 1 March. Couple of days later I realised that something was not right and upon further investigation, I noticed that the HDD that I’d installed in TO (as a NAS) was either corrupted or otherwise not mounted correctly. I proceeded to lodge this with Turris tech support (#003886) but I have yet to receive any response.

Anyway as I have some free time today, I have been looking around to understand the problem and maybe find a solution.

Based on what I’ve come across, BTRFS not coping well with power outages under some configurations is probably my biggest worry.

So these are what I found:

  1. Under Mount Points in Luci, there are four Mounted File Systems:

/dev/mmcblk0p1|/ mounted to /
tmpfs mounted to /tmp
tmpfs mounted to /dev
/dev/sda mounted to /srv (this is the NAS HDD)

  1. If I ls /srv, there is nothing inside it, which is incorrect

  2. Under Mount Points in Luci, there are no Mount Points, although I believe that there was at least one before the incident.

  3. Under LXC Containers in Luci, it shows homeassistant container as Available with a green status, although if I lxc-attach -n homeassistant, it says:

lxc-attach: attach.c: lxc_attach_run_shell: 1230 I/O error - failed to exec shell.

  1. If I lsof | grep ‘/srv’, it says:

lxc-start 9138 root 3w REG 0,25 11544 271 /srv/lxc/homeassistant/homeassistant.log
lxc-start 9138 root 4u unix 0xded71e00 0t0 15552 @/srv/lxc/homeassistant/command type=STREAM
lxc-start 9138 root 12u REG 0,25 0 2333504 /srv/lxc/homeassistant/rootfs/lxc.hold (deleted)

  1. But if I ls /srv/lxc/homeassistant it says the directory is empty.

Any advice please that will lead to its recovery or further diagnostics ascertain its recoverability would be much appreciated, as it has been in limbo for a few days now.

Thank you.

Maybe it will help you, try this:

btrfs check --repair /dev/sda