Hi all !
Recently, my computer crashed in the very moment when I performed a “save” of my LibreOffice spreadsheet, probably some HW issue (so far, not reproducible).
However, after the reboot the file was still there, but empty with a size of 0 bytes and owned by root (user and group) instead of the user. The file resides on my home partition which uses BTRFS. I performed a “btrfs check”, including data checksum verification, and a scrub, both completed without any errors.
In my opinion, BTRFS was exactly designed to prevent these kind of data losses, by keeping the old file ? Or is this some kind of (awkward) LibreOffice behavior to delete a previous file first w/o backups before saving ? If so, then why became the file owned by root ?
Well, the data loss resulted in 45min extra work which was not nice, but it could have been worse.
Before anything else, don’t write or save anything to disk on the chance you need to do a forensic file recovery.
Either clone your drive or clone it without logging in.
By default BTRFS snapshots is not enabled for any User work, like what you store in a subdirectory of /home (eg Dcouments), unless you tweaked either your BTRFS settings or where you save your work, no BTRFS snapshot backups of your work would be done at all.
Even if you saved your files somewhere supported by BTRFS snapshots,
Files can be recovered only if the save was executed and completed.
If the “save file” was either not initiated or even was only partially completed, then it won’t be in a recovery snapshot.
I assume that your system rebooted with a “Last Known Good” image,
I’d recommend you look at what LibreOffice can provide, and that would depend on your auto-backup settings…
I wouldn’t expect that you’d be able to recover your entire spreadsheet, but hopefully a majority of your work.
If you can’t recover the file easily by way of a LO auto-backup,
Then I’d recommend you try to do a forensic recovery using something like PhtoRec…
If the file hasn’t been over-written, you should be able to recover the file
LibreOffice has it’s own AutoSave. On crash it should offer to recover files that were not closed/saved properly. But, neither these options, nor btrfs can help in case of HW issues. IMHO you should investigate the point why LO crashed on writing the file to disk.
As far as I know, the current default is to not have a separate “/home” file system. So that leaves “/home” as part of the root file system using “btrfs”. And because it is a subvolume, it does not get multiple snapshots.
A refresher…
On 15.0, BTRFS was not offered for /home and and /home was mounted as its own partition with XFS as the default.
The only likely way that /home might have been deployed on BTRFS would be if the “Deploy /home on a separate partition” was unchecked, resulting in a single volume formatted as BTRFS and /home as a subdirectory, not a separate partition.
On 15.1, /home is deployed as a BTRFS subvolume of / for the first time, but /home is one of many different file system objects that are excluded from snapshots
The “Default Volumes” section of the SDB BTRFS describe what is excluded (I have no idea why the SDB organizes info this way)
As for snapshots and subvolumes, AFAIK there is no problem by default…
The BTRFS MAN page says that BTRFS subvolumes are created with file system extents unlike LVM subvolumes which are block based…
Expanding on Knurpht’s answer, LibreOffice (usually – you can change the locations if you wish) maintains temporary files in ~/.cache/LibreOffice/???.tmp/ and ~/.config/libreoffice/4/user/backup/.
The settings for automatic file saves and intervals between saves are in “Tools - Options” - Load/Save - General. <Welcome to the LibreOffice Writer Help.
In any case, it usually pays to save a document whenever you take a “thinking pause” and automatically every few minutes – I see that, the default auto-save intervall for LibreOffice is 10 minutes – «I’ve now set it to auto-save more frequently – thanks for the tip!» …
thanks for the many replies and hints. Just some additional information:
During install, I did a manual partitioning, this is why /home residens on a BTRFS partition. In fact, the partition is an LVM logical volume, but as the system rebooted cleanly after the crash, inlcuding those FS checks, I forgot to mention that - sorry. But I think that this has got nothing to do with the issue.
This was not the first save of this spreadsheet, the file was already existing, I just opened it, modifed it and issued the save, when suddently the computer crashed. So, AFAIK the unodified version of that file should have been there ?
Special thanks to tsu2 lol!:good:for the quick hints considering the forensic file recovery. However, this was not required as the spreadsheet was not too complicated, and I was able to fully recreate it off-brain quite quickly.
… and yes, the most import thing to do is to figure out why the computer creashed when I issued the save operation. However, as far as I remember I got some “machine check exception” message by the kernel, followed by a reset (or vice versa), so I gues that this was a HW fault, or maybe an OS issue, but nothing related to Libreoffice. I itensively tried to reproduce that crash, without any success.
The thing what made me real curious is why the previously existing file became was “cut” to 0 bytes and why it changed the owener from my standard user name to root.