NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
rhpot1991
Mar 08, 2021Guide
Enable Bitrot on Files: MV or CP?
So I want to make sure that bitrot protection is enabled on my files, I don't recall if I had it enabled on my shares before files were placed there. According to the documentation you can create a ...
- Mar 08, 2021
You can use "lsattr" to check if a file has CoW enabled or not.
Here my txt file does not have CoW enabled, denoted by the "C" in the end.
root@Databak:~# lsattr /data/Data-dump/MyFile_NoCoW.txt ---------------C /data/Data-dump/MyFile_NoCoW.txt
Here is what a file looks like, that has CoW enabled.
root@Databak:~# lsattr /data/Data-dump/MyFile_CoW.txt ---------------- /data/Data-dump/MyFile_CoW.txt
I don't think the "mv" command is enough to trigger CoW on a file that has previously been marked for No CoW - due to reasons that StephenB mentioned. I think you need to re-create the file - i.e. "cp"
But you can check on the files you moved :)
StephenB
Mar 08, 2021Guru - Experienced User
rhpot1991 wrote:
I replied to you.
Sorry, it was showing up as a separate thread when I replied.
Perhaps rn_enthusiast or mdgm will chime in.
In order for bit-rot protection to work, you need both BTRFS checksums and RAID parity. My understanding is that the only safe way to create the BTRFS checksums is to copy the file data itself after checksums are enabled. That won't happen if the files are moved.
There is a linux command that can also recalculate the checksums - but it is considered dangerous. Normally the file system is unmounted before that command is run.
rn_enthusiast
Mar 08, 2021Virtuoso
You can use "lsattr" to check if a file has CoW enabled or not.
Here my txt file does not have CoW enabled, denoted by the "C" in the end.
root@Databak:~# lsattr /data/Data-dump/MyFile_NoCoW.txt ---------------C /data/Data-dump/MyFile_NoCoW.txt
Here is what a file looks like, that has CoW enabled.
root@Databak:~# lsattr /data/Data-dump/MyFile_CoW.txt ---------------- /data/Data-dump/MyFile_CoW.txt
I don't think the "mv" command is enough to trigger CoW on a file that has previously been marked for No CoW - due to reasons that StephenB mentioned. I think you need to re-create the file - i.e. "cp"
But you can check on the files you moved :)
- rn_enthusiastMar 08, 2021Virtuoso
Had a quick Google and interestingly enough, you might be able to change it on the fly, using "chattr". Have look here:
https://en.wikipedia.org/wiki/ChattrI haven't played around with this much though, changing CoW attributes, but I guess it should work :)
- rhpot1991Mar 09, 2021Guide
Confirmed that moved files have the C attribute, thus lacking CoW. Newly copied files are created without the C attribute, thus having CoW. Weird that they display it like this.
For the sake of making sure that CoW is enabled on these I think I should just copy and be done with it, rather than risking issues later if changing the attribute doesn't perform as needed.
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!