* out of space warning?
@ 2014-12-10 22:54 sys.syphus
2014-12-11 1:29 ` Robert White
2014-12-11 8:16 ` Duncan
0 siblings, 2 replies; 6+ messages in thread
From: sys.syphus @ 2014-12-10 22:54 UTC (permalink / raw)
To: linux-btrfs
I would like to avoid running out of space. is there a way to know
that I am getting close? i'd like to make a script that runs as part
of my bash prompt and lets me know when i am getting close. i know
there are several ways you can run out of space and I'd like to avoid
all of them.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: out of space warning?
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 8:16 ` Duncan
1 sibling, 2 replies; 6+ messages in thread
From: Robert White @ 2014-12-11 1:29 UTC (permalink / raw)
To: sys.syphus, linux-btrfs
On 12/10/2014 02:54 PM, sys.syphus wrote:
> I would like to avoid running out of space. is there a way to know
> that I am getting close? i'd like to make a script that runs as part
> of my bash prompt and lets me know when i am getting close. i know
> there are several ways you can run out of space and I'd like to avoid
> all of them.
Don't do that either. 8-)
(1) you'll grow to hate it.
(2) You know when you are doing things that take a lot of storage. You
instinct for system fullness is already part of your brain-meat.
(3) The system isn't going to explode if it runs out of disk space. (old
UNIX systems used to halt with system errors because running out of
space prevented pipelines from being created, but that's ancient history).
(4) The only _real_ way to run out of space is to be a data hoarder, and
no script in the world is going to help you if that's the case. Ha Ha....
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.
Scripts like this are possible in bash, but consider that every "ls" or
even just enter you type would be followed by a "df" and a "grep" or
whatever in whatever window you are using at the time. etc.
IF you think you are going to run out of space, and you are using _any_
kind of window system, then start a system manager display for a while
until you get the feel for how not out of space you really are.
Nothing gets ignored faster than a text element that essentially never
changes, and once you get in the habbit of ignoring the text you won't
notice when it actually has something to say.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: out of space warning?
2014-12-11 1:29 ` Robert White
@ 2014-12-11 2:46 ` Qu Wenruo
2014-12-11 9:01 ` Erkki Seppala
1 sibling, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2014-12-11 2:46 UTC (permalink / raw)
To: Robert White, sys.syphus, linux-btrfs
-------- Original Message --------
Subject: Re: out of space warning?
From: Robert White <rwhite@pobox.com>
To: sys.syphus <syssyphus@gmail.com>, <linux-btrfs@vger.kernel.org>
Date: 2014年12月11日 09:29
> On 12/10/2014 02:54 PM, sys.syphus wrote:
>> I would like to avoid running out of space. is there a way to know
>> that I am getting close? i'd like to make a script that runs as part
>> of my bash prompt and lets me know when i am getting close. i know
>> there are several ways you can run out of space and I'd like to avoid
>> all of them.
>
> Don't do that either. 8-)
>
> (1) you'll grow to hate it.
>
> (2) You know when you are doing things that take a lot of storage. You
> instinct for system fullness is already part of your brain-meat.
>
> (3) The system isn't going to explode if it runs out of disk space.
> (old UNIX systems used to halt with system errors because running out
> of space prevented pipelines from being created, but that's ancient
> history).
>
> (4) The only _real_ way to run out of space is to be a data hoarder,
> and no script in the world is going to help you if that's the case. Ha
> Ha....
(5) Possible known/unknown kernel bug may cause strange ENOSPC during
balance/replace/scrub... :-)
>
> 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.
>
> Scripts like this are possible in bash, but consider that every "ls"
> or even just enter you type would be followed by a "df" and a "grep"
> or whatever in whatever window you are using at the time. etc.
>
> IF you think you are going to run out of space, and you are using
> _any_ kind of window system, then start a system manager display for a
> while until you get the feel for how not out of space you really are.
>
> Nothing gets ignored faster than a text element that essentially never
> changes, and once you get in the habbit of ignoring the text you won't
> notice when it actually has something to say.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: out of space warning?
2014-12-10 22:54 out of space warning? sys.syphus
2014-12-11 1:29 ` Robert White
@ 2014-12-11 8:16 ` Duncan
1 sibling, 0 replies; 6+ messages in thread
From: Duncan @ 2014-12-11 8:16 UTC (permalink / raw)
To: linux-btrfs
sys.syphus posted on Wed, 10 Dec 2014 16:54:07 -0600 as excerpted:
> I would like to avoid running out of space. is there a way to know that
> I am getting close? i'd like to make a script that runs as part of my
> bash prompt and lets me know when i am getting close. i know there are
> several ways you can run out of space and I'd like to avoid all of them.
With the concerns about your bash prompt registered...
btrfs filesystem show
... is a good choice.
If you have multiple filesystems you can point show at a device/
mountpoint/label/UUID to get the output for just the one.
You'll want to pay particular attention to the individual device lines.
Of course you can grep/sed/otherwise-process that down to a single line
if desired.
If btrfs filesystem show says it's close to out of room, run btrfs
filesystem df for more info. There's lots of information on the wiki and
in various threads here about interpreting the information these commands
output (it takes both commands to get a good picture, but show is good
for brief summary, provided you know to look at the device lines not the
overall total line), and what to do when necessary to return some balance
to the situation.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: out of space warning?
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
1 sibling, 1 reply; 6+ messages in thread
From: Erkki Seppala @ 2014-12-11 9:01 UTC (permalink / raw)
To: linux-btrfs
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.
--
_____________________________________________________________________
/ __// /__ ____ __ http://www.modeemi.fi/~flux/\ \
/ /_ / // // /\ \/ / \ /
/_/ /_/ \___/ /_/\_\@modeemi.fi \/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: out of space warning?
2014-12-11 9:01 ` Erkki Seppala
@ 2014-12-11 9:29 ` Robert White
0 siblings, 0 replies; 6+ messages in thread
From: Robert White @ 2014-12-11 9:29 UTC (permalink / raw)
To: Erkki Seppala, linux-btrfs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-11 9:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-12-11 8:16 ` Duncan
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).