Disk space visualization reddit / selfhosted ---------------------------------------------------------------------- l86rj · 2023-12-29 10:35 I suppose most of you guys have already seen some sort of GUI tool to see disk usage in a pie chart or similar. I'd like to know if there's something like that to use in a server, preferably with a web interface. The tool I picture would display a pie chart showing the space being used in a given partition or folder, with each of its subfolders being represented in a different color. If you click on a segment of a subfolder, the pie would be updated to detail this subfolder instead. It doesn't seem too difficult to implement that (I suppose there are existing javascript components to render pie charts already), but I'd like to know if there are solutions ready to be used before I start reinventing the wheel. ---------------------------------------------------------------------- DickCamera · 2023-12-29 15:41 That actually sounds like a pretty cool project that could be implemented in under a weekend I would think. I would say a cron job to run df/du and parse the output into json and then some webpage using chart.js to parse. But no I'm not immediately aware of anything existing. ---------------------------------------------------------------------- TupaNegreiros · 2023-12-29 15:42 ncdu could do it by SSH ---------------------------------------------------------------------- Lopsided_Speaker_553 · 2023-12-29 16:32 This link popped up as a comment to the first result in google https://serverfault.com/a/436776 I hope it fits your needs. ---------------------------------------------------------------------- traverser___ · 2023-12-29 16:34 Depends what you are running on your serve. On proxmox, I have set it up to send data to influx (built in option, cannot remember its name) and grafana dashboard (from grafana community) which shows the data, including disks space ---------------------------------------------------------------------- l86rj · 2023-12-29 16:53 I'm also using influx and grafana to monitor and display the used space in each partition. But my idea now is to have something more interactive. I'd like to detail the folders on demand, just like the desktop tools do. ---------------------------------------------------------------------- l86rj · 2023-12-29 16:55 That seems to address the problem, but not in the way I was thinking about. It seems it's a CLI solution. I'm wondering if there is something for web (with javascript), and displaying charts. ---------------------------------------------------------------------- l86rj · 2023-12-29 16:58 Maybe I'll have to do it. It really doesn't seem difficult, and I really want to have something like that. But I didn't thought about using cron. I'm thinking about making a backend API that just executes du with the given parameter. For me, the biggest challenge is the front-end though. I have little experience with it. Do you recommend chart.js? ---------------------------------------------------------------------- pogky_thunder · 2023-12-29 17:03 Dashdot is supposed to do that but every time I try it, it can't read my disk space correctly (or at all). It still seems to work ok for most though. ---------------------------------------------------------------------- DickCamera · 2023-12-29 17:07 If you have the data in js format, then yes I would recommend chart.js. I can't say I have tons of experience with it, but whenever I do any front end, I prefer libraries that can be installed/used by including a script tag over any abomination of npm/babel/whatever. The only reason I suggested cron was because if you want to do it on demand, then you need a more complicated webserver setup with possibly cgi or something to actually support executing the du script on demand. Whereas if you just repopulate the data every 15 or N minutes, then you can just F5 the browser when you want a refresh ---------------------------------------------------------------------- guesswhochickenpoo · 2023-12-29 17:11 Not a pie chart but QDirStat functionally does what you want and is available as a docker image from linuxserver.io https://docs.linuxserver.io/images/docker-qdirstat/ ---------------------------------------------------------------------- Lopsided_Speaker_553 · 2023-12-29 17:59 Ahh, but that would mean you'd need to have a web facing process running as root, otherwise results would be incomplete. Not really secure. I think your best bet would be a root cronjob that writes the resulting data to a folder that the web process can then read. Keep in mind that creating a drill down function for all folders could take a while to generate the list needed. ---------------------------------------------------------------------- l86rj · 2023-12-29 23:08 Yeah, I have many stuff being done with cron, but this project specifically is better done on demand, because it's very interactive. I'd like to "zoom in" in different paths on demand. I guess the backend won't be complicated though. I'll make a simple python script with flask that just runs du and returns it in JSON format. I could make a container for the whole thing, and the user will only have to bind-mount the root paths he wishes to make available for display, and also the port he wishes the frontend to be displayed (will be only an apache with a simple page including all the javascript needed). So yeah, I guess it will be a fun weekend project ;p ---------------------------------------------------------------------- l86rj · 2023-12-30 00:41 Wow, that is a really awesome project! It's way more powerful than I thought, but also more complicated. I'll take a better look at it from my desktop, because I'm on mobile now. Thank you! ---------------------------------------------------------------------- l86rj · 2023-12-30 00:58 Oh, you're probably right. I was forgetting about the permissions. I don't mind having root access from the web on my home server (wouldn't be the first one), but that's ugly... I still think a cron job is worse though. I guess I might build my own custom solution but keep it to myself. I don't think it's common/acceptable for docker apps to require root access, is it? ---------------------------------------------------------------------- guesswhochickenpoo · 2023-12-30 01:09 NP. It's definitely a much heavier GUI than I'd like but yes very powerful. If you find anything simpler and that's mobile friendly let me know. ---------------------------------------------------------------------- diffsky · 2023-12-30 03:38 Check out https://github.com/zevv/duc ---------------------------------------------------------------------- Lopsided_Speaker_553 · 2023-12-30 06:22 In a home server running a web service as root is not a problem and running it in docker with a bind mount does indeed have the benefit of being able to read everything. Have fun building it 😁 ---------------------------------------------------------------------- acid_etched · 2023-12-30 06:37 Not quite the same thing but windirstat (or whatever the new updated on is called) does this for any drive mounted on a windows computer. ---------------------------------------------------------------------- l86rj · 2023-12-30 09:03 That's a really nice project, but I'm looking for a web solution. If we could have that chart generated in Javascript, it would be perfect for servers. ---------------------------------------------------------------------- diffsky · 2023-12-30 11:38 It has an option for creating a web view ---------------------------------------------------------------------- shundhammer · 2023-12-30 22:15 In addition to what others here wrote: QDirStat for servers: Use the supplied script on the server, copy the result with "scp" to your desktop and use the full functionality of QDirStat on your PC. https://github.com/shundhammer/qdirstat/blob/master/doc/QDirStat-for- Servers.md ---------------------------------------------------------------------- shundhammer · 2023-12-30 22:21 You are grossly underestimating what it's all about. And if you start out with "du" (forget "df", that's completely unrelated), good luck. QDirStat has grown to 60,000 lines of code over the years. Even if you limit the functionality to a bare minimum and don't document anything in the code, I guess you'll end up with at least a quarter of that. That would become a very busy weekend. Just saying. ;-)