Set file size to zero

Status
Not open for further replies.

spookyfish

Cadet
Joined
Sep 3, 2012
Messages
9
Hi, a while ago I had a 100% disk full error and managed to solve it by using a command which set the file size of a file to 0kb. Since then I have kept a 2gb file on the system in case Of emergencies (there are multiple people using the system so no matter how careful I am to keep it below 80% sometimes it's going to fill up all the way). Anyway, I can't remember what the exact command was. I have tried the echo > command as mentioned in other posts but it's not working for me. If anyone knows of the command I'm talking about that can resize a file please get in touch. Many thanks
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874

willnx

Dabbler
Joined
Aug 11, 2013
Messages
49
There's a better way to prevent the NAS from getting to 100% used, that doesn't require admin intervention if you've created some (or just one) datasets (or volumes) as children of your main volume.

Either quotas on the children datasets / volumes. (make sure to not over provision the quotas)
-or-
From the web GUI:
Storage > Volumes > View Volumes > Name of parent volume
Edit ZFS options > Reserved space for this volume > 2

This will prevent any of the child datasets / volumes from using 100% of the blocks available.
Important: you can only sharing the child dataset / volume namespace, i.e. /mnt/vol = main volume, /mnt/vol/cifs = some dataset, users only write under /mnt/vol/cifs and never to /mnt/vol, or /mnt/vol/not_a_dataset_or_volume.

*I'm sure you already know, but 100% full via the CLI or web GUI doesn't mean 100% of all blocks within the system used (dang rounding 999999 / 1000000 to 100%...).
100% blocks used is a very painful/ bad problem; it's entirely possible to fill a filesystem so full that you're unable to delete anything. Setting a reserved space up like mentioned above prevents this scenario.
 

spookyfish

Cadet
Joined
Sep 3, 2012
Messages
9
depasseg - yes, that's the thread i was looking at and the echo > command did not work for me, it just returned a "disk full" error. i'm pretty sure the command i used before was to name a file and then specify a size for that file (0kb, 20kb, 200000kb etc etc) and then the system would resize the file to the specified amount. i just can't remember what that command was, any ideas??
 

spookyfish

Cadet
Joined
Sep 3, 2012
Messages
9
willnx - thanks for that, i will look into it as soon as i have my system working again…. any ideas on the command i used before? thanks
 
Status
Not open for further replies.
Top