• 0 Posts
  • 23 Comments
Joined 2 years ago
cake
Cake day: July 23rd, 2023

help-circle
  • Advice from a long time sysadmin: You’re probably asking the wrong question. ncdu is an efficient tool, so the right question is why it’s taking so long to complete, which is probably an underlying issue with your setup. There are three likely answers:

    1. This drive is used on a server specifically to store very large numbers of very small files. This probably isn’t the case, as you’d already know that and be looking at it in smaller chunks.
    2. You have a network mount set up. Use the -x option to ncdu to restrict your search to a single filesystem, or --exclude to exclude the network mount and your problem will be solved (along with the traffic spike on your LAN).
    3. You have a single directory with a large number of small files that never get cleared, such as from an e-mail deadletter folder or a program creating temp files outside of the temp directories. Once a certain number of files is reached, accessing a directory slows down dramatically. The following command will find it for you (reminder - make sure you understand what a command does before copying it into a terminal, DOUBLY so if it is run as root or has a sudo in it). Note that this will probably take several times as long to run as ncdu because it’s doing several manipulations in series rather than in parallel.

    sudo find $(grep '^/' /etc/fstab | awk '{print $2}') -xdev -type f -exec dirname {} \; | sort | uniq -c | sort -nr | head

    explanation

    This command doesn’t give an exact file count, but it’s good enough for our purposes.

    sudo find # run find as root

    $( … ) # Run this in a subshell - it’s the list of mount points we want to search

    grep ‘^/’ /etc/fstab # Get the list of non-special local filesystems that the system knows how to mount (ignores many edge-cases)

    awk ‘{print $2}’ # We only want the second column - where those filesystems are mounted

    -xdev # tell find not to cross filesystem boundaries

    -type f # We want to count files

    -exec dirname {}; # Ignore the file name, just list the directory once for each file in it

    sort|uniq -c # Count how many times each directory is listed (how many files it has)

    sort -nr # Order by count descending

    head # Only list the top 10

    If they are temp files or otherwise not needed, delete them. If they’re important, figure out how to break it into subdirectories based on first letter, hash, or whatever other method the software creating them supports.













  • The way this works in the server world is “95th percentile” billing. They track your bandwidth usage over the course of the month (probably in 5 minute intervals), strike off the 5% highest peaks, and your bill for the month is based on the highest usage remaining.

    That’s considerably more honest than charging you based solely on the highest usage you could theoretically use at any time point in a 24 hour period (which is how ISPs define the “max bandwidth”) and then charging you again or cutting off your service if you use more than a certain amount they won’t even put in writing.







  • literally no one will ever have that problem, but lets humor your ridiculous made up bullshit

    Wow, your username really fits.

    Actually, it’s a description of some of the issues I’m dealing with right now. And yes, we’re DIYing it with RJ45 wired switching outlets on a separate vlan and subnet. And yes, we use a chest freezer.

    And yes, there are more automatic and passive ways to do some of these things, like planting deciduous trees to shade your south wall in summer but not winter. Not everyone owns their home and land though.


  • There are problems they can actually solve, mostly heating and power related:

    • In summer, lower the blinds on south facing windows when the sun comes up to reduce solar heating, then raise them in the evening to increase air flow against the window panes. This reduces the need for air conditioning, resulting in a surprising amount of power saved.

    • On a home solar system, start the washing machine, dishwasher, and dryer that were loaded in the morning when the batteries reach 80% charge. Allow them to run off the inverter rather than taking the charge/discharge losses involved in battery storage, reducing the size of both battery bank and solar array needed.

    • Lower the freezer temperature when there is a power surplus, and raise it back to normal when not so that cooling energy is used when it’s cheapest/most available

    If you don’t work from home, you can’t do the second two yourself. They require automation. Reducing baseload requirements and battery storage needs can make a transition to renewable power much cheaper and more efficient. With mass adoption, that extends to power grids and not just off-grid homes, and has significant effects on things like the amount of lithium that needs to be mined or the number of coal and LNG power plants that are needed for times that are off-peak for wind and solar generation.