How to delete/rewrite a corrupted file in a read only snapshot?
howdy,
I'm seeing this during a background check:
[374402.156920] BTRFS warning (device dm-18): checksum error at logical 4401320624128 on dev /dev/dm-18, physical 2939697954816, root 63534, inode 595460, offset 1506283520, length 4096, links 1 (path: nobck/file2)
this is in a read only btrfs send snapshot, so I can't just delete the file or the snspshot (I have 20 historical ones all with the same broken fine).
can I either
1) force delete it with some admin tool
2) even better force/overwrite it with the correct file from source?
Thanks,
Marc
Signature · 3 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R. Home page: http://marc.merlins.org/ | PGP 7F55D5F27AAF9D08
Quoted 5 lines · Marc MERLIN
howdy,
I'm seeing this during a background check:
[374402.156920] BTRFS warning (device dm-18): checksum error at logical 4401320624128 on dev /dev/dm-18, physical 2939697954816, root 63534, inode 595460, offset 1506283520, length 4096, links 1 (path: nobck/file2)
Quoted 7 lines
this is in a read only btrfs send snapshot, so I can't just delete the file or the snspshot (I have 20 historical ones all with the same broken fine).
can I either
1) force delete it with some admin tool
2) even better force/overwrite it with the correct file from source?
You can flip subvolumes between read-only and read-write:
$btrfs prop set yoursubvolume ro false
See "man btrfs-property" for details.
This should allow you to delete the broken file or replace it.
Good luck!
Holger
Quoted 10 lines · Holger Hoffstätte
Quoted 9 lines · Marc MERLIN
howdy,
I'm seeing this during a background check:
[374402.156920] BTRFS warning (device dm-18): checksum error at logical 4401320624128 on dev /dev/dm-18, physical 2939697954816, root 63534, inode 595460, offset 1506283520, length 4096, links 1 (path: nobck/file2)this is in a read only btrfs send snapshot, so I can't just delete the file or the snspshot (I have 20 historical ones all with the same broken fine).
Quoted 6 lines
Quoted 3 lines
can I either
1) force delete it with some admin tool
2) even better force/overwrite it with the correct file from source?You can flip subvolumes between read-only and read-write:
This will break replication chain.
Quoted 11 lines · Marc MERLIN
howdy,
I'm seeing this during a background check:
[374402.156920] BTRFS warning (device dm-18): checksum error at logical 4401320624128 on dev /dev/dm-18, physical 2939697954816, root 63534, inode 595460, offset 1506283520, length 4096, links 1 (path: nobck/file2)this is in a read only btrfs send snapshot, so I can't just delete the file or the snspshot (I have 20 historical ones all with the same broken fine).
can I either
1) force delete it with some admin tool
That would break any later incremental receive.
Quoted 1 line
2) even better force/overwrite it with the correct file from source?
That's possible manually.
If you can get the correct content of that sector, you can manually write it back to the location (all needed info is already in that line, including where the device is, what's the physical offset, the size)
And later verify with scrub to make sure it's properly fixed.
Thanks,
Qu
Quoted 3 lines
Thanks,
Marc
Quoted 8 lines · Qu Wenruo
Quoted 2 lines
can I either
1) force delete it with some admin toolThat would break any later incremental receive.
Quoted 1 line
2) even better force/overwrite it with the correct file from source?
That's possible manually.
If I change the snapshot to readwrite, and cat the good file into the corrupted one
cat good > /path/to/bad
will that work, or will that allocate new COW blocks and do weird things that would break later brfs send/receive?
Thanks,
Marc
Signature · 3 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R. Home page: http://marc.merlins.org/ | PGP 7F55D5F27AAF9D08
Quoted 8 lines · Marc MERLIN
Quoted 7 lines · Qu Wenruo
Quoted 2 lines
can I either
1) force delete it with some admin toolThat would break any later incremental receive.
Quoted 1 line
2) even better force/overwrite it with the correct file from source?
Quoted 7 lines
Quoted 1 line
That's possible manually.
If I change the snapshot to readwrite, and cat the good file into the corrupted one
cat good > /path/to/bad
will that work, or will that allocate new COW blocks and do weird things that would break later brfs send/receive?
As long as you changed the snapshot to RW, it would break later incremental receive IIRC, but I'm not 100% sure.
And for that cat, it would definitely lead to COW.
So, no, that would not fix the corrupted sector, you have to go the dangerous way.
Thanks,
Qu
Quoted 3 lines
Thanks,
Marc