Hello,
I am using TrueNas Core (ZFS) atm with a few hundreds of TB. I use it mainly for storing images from different cases. One case can have several images. The images are always in own folders in the subfolder "DS". Sometimes these arent images but folders with thousands of files instead of one image.
I have a admin panel tool to manage all the images/cases on a different server. Thats a simple php apache webserver. I can "manage" the images/cases on the storage so far by only creating automatically the right folders and sub folders. So I create a case XYZ in the admin panel and automatically create the right folders and subfolders on the storage server. If I add an image in the admin panel to the case, it automatically creates the right subfolder in the "case"/DS/"image" dir.
I have a table with all cases and one with all images on the webserver. Now I would like to have some more information about the cases and each image. I would like to have a column in the table with size of that folder. So in the case table, I would like to have the size of the complete case, that means all images etc. On the image table I would like to have the size of the folder that contains the image.
In my admin panel, I have all the right path to the folders. Since the TrueNas is mounted to the webserver, I could just use the filesize function of PHP recursively and done. But thats obviously a bad idea since it would recalculate the size every single time.
So my question is:
Is there some way to calculate the size of folders directly on the TrueNas system? So I can call it somehow from my webserver. And the size is just recalculated when something changes.
My plan B would be a crawler that runs every night at a specific time and then recalculates every size. But thats inefficient too and not live.
I am using TrueNas Core (ZFS) atm with a few hundreds of TB. I use it mainly for storing images from different cases. One case can have several images. The images are always in own folders in the subfolder "DS". Sometimes these arent images but folders with thousands of files instead of one image.
I have a admin panel tool to manage all the images/cases on a different server. Thats a simple php apache webserver. I can "manage" the images/cases on the storage so far by only creating automatically the right folders and sub folders. So I create a case XYZ in the admin panel and automatically create the right folders and subfolders on the storage server. If I add an image in the admin panel to the case, it automatically creates the right subfolder in the "case"/DS/"image" dir.
I have a table with all cases and one with all images on the webserver. Now I would like to have some more information about the cases and each image. I would like to have a column in the table with size of that folder. So in the case table, I would like to have the size of the complete case, that means all images etc. On the image table I would like to have the size of the folder that contains the image.
In my admin panel, I have all the right path to the folders. Since the TrueNas is mounted to the webserver, I could just use the filesize function of PHP recursively and done. But thats obviously a bad idea since it would recalculate the size every single time.
So my question is:
Is there some way to calculate the size of folders directly on the TrueNas system? So I can call it somehow from my webserver. And the size is just recalculated when something changes.
My plan B would be a crawler that runs every night at a specific time and then recalculates every size. But thats inefficient too and not live.