Results 1 to 8 of 8

Thread: BTRFS: file gone after crash

  1. #1
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    26

    Exclamation BTRFS: file gone after crash

    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.

    Regards, Sven / Wumpus

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,149
    Blog Entries
    2

    Default Re: BTRFS: file gone after crash

    Well,

    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

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,680
    Blog Entries
    15

    Default Re: BTRFS: file gone after crash

    Hi
    You configured your setup for /home to be on btrfs, the default was to use xfs for /home?

    Code:
    mount | grep home
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  4. #4
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,806
    Blog Entries
    14

    Default Re: BTRFS: file gone after crash

    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.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,507
    Blog Entries
    3

    Default Re: BTRFS: file gone after crash

    Quote Originally Posted by malcolmlewis View Post
    You configured your setup for /home to be on btrfs, the default was to use xfs for /home?
    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.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,149
    Blog Entries
    2

    Default Re: BTRFS: file gone after crash

    Quote Originally Posted by nrickert View Post
    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)

    https://en.opensuse.org/SDB:BTRFS

    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...

    https://btrfs.wiki.kernel.org/index....trfs-subvolume

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,518

    Default Re: BTRFS: file gone after crash

    Quote Originally Posted by the_wumpus View Post
    performed a "save" of my LibreOffice spreadsheet
    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. <https://help.libreoffice.org/Common/..._Automatically>.

    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!» …

  8. #8
    Join Date
    Oct 2008
    Location
    Germany, Bremen
    Posts
    26

    Angry Re: BTRFS: file gone after crash

    Hi all,

    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 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.

    Kind Regards, Sven / Wumpus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •