× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Defrag can consume free space on disks.

BaJohn
Virtuoso

Defrag can consume free space on disks.

Being a newbie I have been trawling the forum to increase my knowledge of how things work.
I was shocked to find this not necessarily obvious information. If it isn't obvious to me, then it isn't to others.
The following is my attempted simple explanation of how carrying out a Defrag can affect the data stored on your system.

Conditions:-
1. Using new NASOS that utilizes BTRFS.
2. Use snapshots.
3. Bitrot protection on (CoW implemented)
4. Files in the share are frequently modified.
5. You run the NAS Defrag.

Underlying problem is that the defrag breaks the snapshot links, so the data has to be replicated instead.

This is important so that people near full utilisation of their disk DO NOT carry out a Defrag if they meet the conditions above.
Hope this is helpful to highlight this. Being a newbie, I know I would want this information.

Perhaps this is a facility that will be rectified in a later version of the OS?
Message 1 of 9
StephenB
Guru

Re: Defrag can consume free space on disks.

There already are several places in the forum where we point out that CoW shouldn't be enabled in cases where files are frequently modified. This is just one example (the file was fragmented in the first place because CoW was enabled and it was modified).

I believe 6.1.9 was adjusted so the snapshots are not defragmented. If a file in the main share is defragmented because of CoW then either you skip defragging that file, or you no longer share blocks with the snapshot (increasing space). There are no other options. There is a btrfs "snapshot aware" defrag option, but it created problems so the btfrs folks turned it off.

Note also that when the volume becomes full the NAS should automatically start deleting snapshots to free up space.

In general it is a bad idea to let the volume become full, and it is best to fix that by deleting files (or snapshots) before doing other stuff.

Perhaps edit your original post to add a condition: Files in the share are frequently modified.
Message 2 of 9
BaJohn
Virtuoso

Re: Defrag can consume free space on disks.

StephenB wrote:
Note also that when the volume becomes full the NAS should automatically start deleting snapshots to free up space.

Yes I was aware of that, but not certain at what percentage full.

In general it is a bad idea to let the volume become full, and it is best to fix that by deleting files (or snapshots) before doing other stuff.

I do not intend to let the system get beyond about 80% full.

Perhaps edit your original post to add a condition: Files in the share are frequently modified.

Done - Thanks

I believe that a manual is being produced for the new OS.
That may help with some of these questions.
Do we have a projected release date?
Message 3 of 9
mdgm-ntgr
NETGEAR Employee Retired

Re: Defrag can consume free space on disks.

BaJohn wrote:
StephenB wrote:
Note also that when the volume becomes full the NAS should automatically start deleting snapshots to free up space.

Yes I was aware of that, but not certain at what percentage full.

95% full.
BaJohn wrote:

StephenB wrote:
In general it is a bad idea to let the volume become full, and it is best to fix that by deleting files (or snapshots) before doing other stuff.

I do not intend to let the system get beyond about 80% full.

Assuming your data volume is called e.g. data you could try this (if it is called something different then modify the command accordingly):

# echo 20 > /data/._share/.snapshot_prune

With this file in place with this value snapshots will be pruned to get usage back down if usage exceeds 80%.

I think you may need to restart readynasd or reboot for this setting change to take effect.
BaJohn wrote:

I believe that a manual is being produced for the new OS.
That may help with some of these questions.
Do we have a projected release date?

There is already a new software manual available. See http://support.netgear.com/product/ReadyNAS-OS6
Message 4 of 9
BaJohn
Virtuoso

Re: Defrag can consume free space on disks.

mdgm wrote:
BaJohn wrote:

I believe that a manual is being produced for the new OS.
That may help with some of these questions.
Do we have a projected release date?

There is already a new software manual available. See http://support.netgear.com/product/ReadyNAS-OS6

I have already perused the new software manual many times.
Sorry - It was a bad choice of words on my part.

I was under the impression that a new 'Technical manual' is being produced for the new OS, that would help explain the way that Defrag and other such complicated processes work.
i.e. instead of dragging out the fine technical details piecemeal via the forum and multiple posts, we would have in one place a definitive source. Apologies if I have totally misread something somewhere.
Yes I know that with each new facility, it would require revisiting etc.
Perhaps we need a separate post/document/pdf on each technical process (Defrag, Disk Test, disk formatting, snapshots, etc), that could ONLY be updated by an expert.
It would have integrity, be the definitive source for that process, be updated when it was identified that some information was missing and be continually used.
It would also stop some of the continual round and round discussions about how things work.
I would suggest a special forum/post for the "How it works" questions, then put up a topic such as defragging, put a peg in the ground with a starting document (gather together all information to date) and when it is discovered that some information is missing an expert adds it to the document. If ALL questions on the subject are directed to the one place then this would over a period of time become a better and better document. The down side is that an expert would need to update the information regularly, but the upside is they would spend less time answering the same questions, or discussing the same ideas over and over and over again.
Please feel free to shoot me down or whatever.
(If you are already doing this, then sorry, it is not clear to me as a newcomer that it is being done.)
Message 5 of 9
mdgm-ntgr
NETGEAR Employee Retired

Re: Defrag can consume free space on disks.

I believe there are plans to have an article on volume maintenance options. It is a good idea.
Message 6 of 9
StephenB
Guru

Re: Defrag can consume free space on disks.

mdgm wrote:
I believe there are plans to have an article on volume maintenance options. It is a good idea.
I think it'd be a very useful article. A clear description on what each of the functions does (including "balance" would be helpful)

It'd be good to have an article describing CoW, and considerations for setting up snapshots and bitrot protection. I don't think a full btrfs tutorial is needed, just an overview of the "cloning" idea as it applies to the NAS snapshot structure and the usual discussion on both the value and limitation of snapshots - fragmentation, impracticality of backing up snapshots, etc. This could possibly be merged into one article (or maybe cross-link them so people can easily get from one to the other).
Message 7 of 9
rovingmedic
Tutor

Re: Defrag can consume free space on disks.

+1
Message 8 of 9
hmuessig
Luminary

Re: Defrag can consume free space on disks.

+1
Message 9 of 9
Top Contributors
Discussion stats
  • 8 replies
  • 5284 views
  • 0 kudos
  • 5 in conversation
Announcements