"Structure needs cleaning"/"Orphan file not empty on read-only fs" when snapshotting an ext4 fs via LVM #1126

Closed
opened 2025-08-11 15:28:26 +00:00 by 30p87 · 2 comments

What I'm trying to do and why

Snapshot and mount my in-use ext4-on-LVM data fs; via borgmatic and manually, via LVM.

Steps to reproduce

  1. Have original LV in-use, with orphan inodes (so an in-use fs, eg. using a loop dev to test does very likely not work)
  2. Snapshot it read-only via LVM
  3. If the original fs is already marked as needs-recovery, EXT4-fs fails to recover it due to it being r/o
  4. Mount it as r/w
  5. Observe EXT4-fs always removing the same amount of orphans, leading to the conclusion that, indeed, the needs-recovery tag is inherited from the original LV

Actual behavior

r/o snapshot:

EXT4-fs (dm-7): write access unavailable, skipping orphan cleanup
EXT4-fs (dm-7): recovery complete
EXT4-fs error (device dm-7): ext4_mark_recovery_complete:6262: comm mount: Orphan file not empty on read-only fs.
EXT4-fs (dm-7): mount failed

r/w snapshot:
EXT4-fs (dm-7): orphan cleanup on readonly fs
EXT4-fs (dm-7): 130 orphan inodes deleted
EXT4-fs (dm-7): recovery complete
EXT4-fs (dm-7): mounted filesystem 32ce7327-b2f0-4375-ae1b-23292898722a ro with ordered data mode. Quota mode: none.

Expected behavior

Snapshot as r/w by default, or check if needed beforehand (eg. sudo debugfs -R features /dev/data/data 2>&1 | grep needs_recovery)

Other notes / implementation ideas

Edit /usr/lib/python3.13/site-packages/borgmatic/hooks/data_source/lvm.py, line 107:
--- 'r', # Read-only.
+++ 'rw', # Read-write.

as quick fix; does not survive a package upgrade ofc

borgmatic version

2.0.7

borgmatic installation method

Official Arch repos

Borg version

borg 1.4.1

Python version

Python 3.13.5

Database version (if applicable)

No response

Operating system and version

NAME="Arch Linux" (latest testing packages)

### What I'm trying to do and why Snapshot and mount my in-use ext4-on-LVM data fs; via borgmatic and manually, via LVM. ### Steps to reproduce 1. Have original LV in-use, with orphan inodes (so an in-use fs, eg. using a loop dev to test does very likely not work) 2. Snapshot it read-only via LVM 3. If the original fs is already marked as needs-recovery, EXT4-fs fails to recover it due to it being r/o 4. Mount it as r/w 5. Observe EXT4-fs always removing the same amount of orphans, leading to the conclusion that, indeed, the needs-recovery tag is inherited from the original LV ### Actual behavior r/o snapshot: EXT4-fs (dm-7): write access unavailable, skipping orphan cleanup EXT4-fs (dm-7): recovery complete EXT4-fs error (device dm-7): ext4_mark_recovery_complete:6262: comm mount: Orphan file not empty on read-only fs. EXT4-fs (dm-7): mount failed r/w snapshot: EXT4-fs (dm-7): orphan cleanup on readonly fs EXT4-fs (dm-7): 130 orphan inodes deleted EXT4-fs (dm-7): recovery complete EXT4-fs (dm-7): mounted filesystem 32ce7327-b2f0-4375-ae1b-23292898722a ro with ordered data mode. Quota mode: none. ### Expected behavior Snapshot as r/w by default, or check if needed beforehand (eg. sudo debugfs -R features /dev/data/data 2>&1 | grep needs_recovery) ### Other notes / implementation ideas Edit /usr/lib/python3.13/site-packages/borgmatic/hooks/data_source/lvm.py, line 107: --- 'r', # Read-only. +++ 'rw', # Read-write. as quick fix; does not survive a package upgrade ofc ### borgmatic version 2.0.7 ### borgmatic installation method Official Arch repos ### Borg version borg 1.4.1 ### Python version Python 3.13.5 ### Database version (if applicable) _No response_ ### Operating system and version NAME="Arch Linux" (latest testing packages)
30p87 changed title from "Orphan file not empty on read-only fs" when snapshotting an ext4 fs via LVM to "Structure needs cleaning"/"Orphan file not empty on read-only fs" when snapshotting an ext4 fs via LVM 2025-08-11 15:40:00 +00:00
Owner

Thanks for filing this and providing all the detail! I went ahead and went with your r -> rw solution for simplicity. This is changed in main and will be part of the next release.

Thanks for filing this and providing all the detail! I went ahead and went with your `r` -> `rw` solution for simplicity. This is changed in main and will be part of the next release.
Owner

Released in borgmatic 2.0.8!

Released in borgmatic 2.0.8!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1126
No description provided.