linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert White <rwhite@pobox.com>
To: Erkki Seppala <flux-btrfs@inside.org>, linux-btrfs@vger.kernel.org
Subject: Re: out of space warning?
Date: Thu, 11 Dec 2014 01:29:26 -0800	[thread overview]
Message-ID: <548963F6.7010703@pobox.com> (raw)
In-Reply-To: <m49iohiblw2.fsf@coffee.modeemi.fi>

On 12/11/2014 01:01 AM, Erkki Seppala wrote:
> Robert White <rwhite@pobox.com> writes:
>
>> You don't check your car's gas tank every time you put your foot on
>> the brake, you don't want to check your free space every time your
>> system finishes every tiny command you type.
>
> Well, actually my car makes a bling every 10 km once it reaches <=80 km
> range, and I don't mind it at all ;-).
>
> As an actual answer, there are monitoring systems that do this, such as
> Icinga (fork of Nagios). In fact, I just recently had the same problem -
> starting a big download might eat up the space and thus terminate the
> download prematurely although I was in position for hours to make up
> more space, so I installed Icinga. Haven't yet configured yet, though,
> so cannot say if it's going to help me :-).
>
> A practical alternative: one could write a script that outputs only the
> amount of free space in a device and add that number to your prompt;
> possibly to your RPROMPT as to now take too much space from your command
> line. Idea extensible to displaying only space from volumes with space
> less than a critical amount etc.
>

I understood exactly what you wanted to do with the prompt script. They 
were quite the rage some time back. I can give you examples off the top 
of my head...

But there are issues and costs.

Lets say you use:

PS1="\$(df --human --output=avail / | tail -1) $ "

You'll end up seeing

106G $

and eventually it will be meaningless. And if you bury it in amongst the 
other prompt stuff. So if I added that to my distro's default prompt and 
made it track the current directory as I moved around...


PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w PS1="\$(df --human 
--output=avail \$PWD | tail -1) \$\[\033[00m\] "

it will fade into the background noise just as fast and pointlessly as 
the rest of the prompt you usually ignore. But now there's a fork and 
exec to pay.

The difference between the prompt thing and your car is that it only 
goes "ding" when you need to pay attention. So now you are putting a 
whole if then thing into the deal.

And you can do that too by defining the PROMPT_COMMAND="whatever". That 
command can do anything "before issuing the prompt" including making 
arbitrary checks and making the speaker go "bing" if you are running low.

And how many filesystems will you be watching?

And if you want btrfs specific stuff (a la btrfs fi show /) you need to 
be root, and I dearly hope you aren't logging into your box as root for 
regular use purposes.

And so on...

There is an old saying "The more you over-think the plumbing, the easier 
it is to stop up the pipes."

If you suffer a system problem (like running out of available ram) and 
your system is thrashing you just deprived yourself of the shell prompt 
because that df command is going to be thrashing along with the rest of it.

So you are correct, there are _lots_ of monitoring methodologies out 
there. KDE, Gnome, and XFCE all provide monitoring widgets that can keep 
you aprised of the current state and fullness of your system storage. 
And they can ring bells and change colors when it gets to alarming 
thresholds.

But doing it to your _prompt_ will get old real fast if you are dealing 
when it matters.





  reply	other threads:[~2014-12-11  9:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 22:54 out of space warning? sys.syphus
2014-12-11  1:29 ` Robert White
2014-12-11  2:46   ` Qu Wenruo
2014-12-11  9:01   ` Erkki Seppala
2014-12-11  9:29     ` Robert White [this message]
2014-12-11  8:16 ` Duncan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=548963F6.7010703@pobox.com \
    --to=rwhite@pobox.com \
    --cc=flux-btrfs@inside.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).