NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
garyd9
Jun 25, 2016Virtuoso
snapshots and defrag - revisited...
I've seen several places in this forum where it's mentioned that defragmenting a share that has snapshots WILL cause the reference links between the primary files and the snapshot versions to be brok...
StephenB
Jun 28, 2016Guru - Experienced User
garyd9 wrote:
First, it appears that the breaking of reference links (snapshots) happens at a FILE level. Then, it will only happen IFF that particular file is fragmented when the defrag is run.
Correct. Though there are some use cases where files are essentially always fragmented when snapshots are frequently taken. An SQL database is one example. If the current database is in a snapshot, then any database update will fragment the file. That would also happen with a torrent.
garyd9
Jun 28, 2016Virtuoso
taking this a bit further...
The frontview UI, for shares and LUNs has a configuration option called "Bit Rot Protection (Copy-on-write)" As far as I can tell, at the btrfs level, this controls the "C" attribute (as visible with lsattr and set with chattr.) btrfs documentation calls this a 'nocow' or 'nodatacow' attribute.
A normal person (or even one with a technical background) would probably assume that turning of copy on write would prevent copy on write from occurring. This would be useful for preventing duplicate copies being made on defrag.
Through no fault of Netgear, however, btrfs really mis-represents this attribute. It does NOT prevent copy on write. Oh, it will prevent you from doing "cp --reflink" from the shell, but that isn't something that most readyNAS users would be messing with anyway. It does NOT prevent snapshots and snapshots on nodatacow files, directories and subvolumes will STILL make use of COW regardless of this attribute. (I'm not sure if you can snapshot a subvolume mounted with the nodatacow mount option.)
What this attribute DOES block is the data checksum that helps with "bit rot" detection.
So... I have no idea what GOOD the attribute actually does. I suppose it might make disk writes a TINY bit faster (and perhaps btrfs scrubs a bit faster if all your shares have COW/bitrot protection turned off.)
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!