NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Zippyduda
May 02, 2018Aspirant
Deleting large file fails and crashes NAS
Hi all.
I have a 300GB file that I want to delete however when I try to do it via Windows or SSH it fails and crashes the NAS, meaning I have to remove the power to reboot it (it doesn't respond to...
- May 06, 2018
You could try a single truncation via ssh
truncate -s 0 myfile.ext
Progressive truncation just uses different parameters for -s (size). For instance, -s 100G or -s 100M.
Echo is another tool that can truncate a file.
echo > myfile.ext
Either way, turn snapshots off before you do this. Perhaps also disable checksums and quota if they are enabled (look on the volume settings wheel).
If it works, I suggest running a balance afterwards. If that also locks up, then post back.
StephenB
May 06, 2018Guru - Experienced User
Zippyduda wrote:
I've replied twice now and my reply has been deleted! Don't know what's going on.
There is an automated spam filter that sometimes misbehaves. Netgear is supposed to monitor it, and release legit posts - but sometimes they fall behind or miss them. Often there is a lot of spam.
It's fine to PM me on this (esp. if I am in the conversation); I can also release them.
StephenB
May 06, 2018Guru - Experienced User
You could try a single truncation via ssh
truncate -s 0 myfile.ext
Progressive truncation just uses different parameters for -s (size). For instance, -s 100G or -s 100M.
Echo is another tool that can truncate a file.
echo > myfile.ext
Either way, turn snapshots off before you do this. Perhaps also disable checksums and quota if they are enabled (look on the volume settings wheel).
If it works, I suggest running a balance afterwards. If that also locks up, then post back.
- ZippydudaMay 07, 2018Aspirant
I've disabled quotas, however I cannot disable checksum as it is stating I have bit rot protection enabled on one or more shares. How do I go about turning this off?
- ZippydudaMay 07, 2018Aspirant
Nevermind, I've found out how to disable it on each share :)
- ZippydudaMay 07, 2018Aspirant
Currently running the truncate command. Got the file I want to remove from 297GB to 200GB successfully. Now going to 100GB. Then will go to 0.
- ZippydudaMay 07, 2018Aspirant
That's worked, thank you so much :) One last question, will it cause any issues now I've turned checksum, quotas and Bit Rot Protection off when I go to Balance the disks? Should I turn these all back on before doing a Balance.
- mdgm-ntgrMay 07, 2018NETGEAR Employee Retired
Whatever you prefer.
Though when the file was deleted any chunks that were emptied completely would have automatically been returned to unallocated space. If you look in btrfs.log you may well find that the space allocated is already close to what's consumed.
A balance will move data around so that chunks are emptied and those emptied chunks are returned to unallocated space.
- StephenBMay 07, 2018Guru - Experienced User
mdgm-ntgr wrote:
Whatever you prefer.
My impression is that you haven't been running balances regularly - if that's the case, I'd leave them off for now. Quotas and checksums both add some additional load to the NAS, so the balance might proceed a bit more quickly w/o them.
Then you can turn them back on if you wish, and also set up a maintenance schedule for defrag, scrub, balance, and perhaps disk tests via the volume settings. I run them each once a quarter myself.
mdgm-ntgr wrote:
If you look in btrfs.log you may well find that the space allocated is already close to what's consumed.
A balance will move data around so that chunks are emptied and those emptied chunks are returned to unallocated space.
To add to this - BTRFS free space can either be allocated or unallocated. The system works best when there is a healthy amount of unallocated free space. As you delete files, you normally end up with more and more allocated free space. The balance takes care of that.
If you run them regularly, then they generally don't take a long time. But if you wait until all the space is allocated, it can take quite a while (and the NAS won't be very responsive while it is running).
Related Content
NETGEAR Academy

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