Bug#192146: apt-get: nice if it warns very low disk space for normal system operation.
Matt Zimmerman wrote:
>
> On Tue, May 06, 2003 at 08:49:45PM +0900, Chiaki wrote:
>
> > When disk space is low, apt-get install something operation (invoked by
> > superuser) can uses the disk space over the watermark for the ordinary
> > user (as in ext2 filesystem) and as a result, when normal user tries to
> > use the system it finds the filesystem in which /var/spool/apt is located
> > having no usable space left. Often this causes undesirable side effects.
>
> s/apt-get install something/any/
>
> This doesn't seem like apt's responsibility. You could fill the disk just
> as easily using tar or dd as with apt (more easily in fact).
>
> In order for apt to warn about this, it would need to have an undesirable
> amount of intelligence about the type and configuration of the filesystem.
> apt doesn't know anything about filesystems, and there is no reason for it
> to learn now.
>
Thank your for taking the time to respond to my wish list posting about
apt behavior.
Your points are well taken, but under linux, I can be a little
careless since I am the sole user of this home PC and
I do need to get to update packages from time to time.
Anyway, regarding the file space detection,
the most likely culprit would be the usage under
/var/cache/apt. (Ordinary users tend to forget to run
apt-get autoclean from time to time [another warning
candidate...]), and so /var/cache/apt can fill up
over time.)
If we restrict the focus to /var/cache/apt,
won't the detection be a simple matter of running
df -k /var/cache/apt and look at the remaining size?
On my PC, it goes like this.
df -k /var/cache/apt
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/scsi/host0/bus0/target4/lun0/part6
7053444 6151964 543184 92% /
Aga. devfs device name struck...
But we can use -P flag to df.
ishikawa@duron$ df -k -P /var/cache/apt
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/scsi/host0/bus0/target4/lun0/part6 7053444 6151980
543168 92% /
ishikawa@duron$ df -k -P /var/cache/apt | tail -1 | awk '{ print $4; }'
543168
The last command is to obtain the remaining capacity.
Yes, I agree that checking the watermark (reserved for user)
is rather difficult, but then simple checking for this
remaining space or checking for the percentage is just fine.
If remaining space is less than 5% warn the user, etc..
Since apt-get is built to show the exact amount of
file space used for installing new package and
seem even to bother caculating the difference between
the space occuped by the current version of the package
and the space occuped by the new version of the existing packages,
a little extra effort to show the remaining file space at the
end of apt-get at the end of the execution won't hurt IMHO
(and the calculation should not be that hard and
users are better off even with a crude estimate based on df output.).
Anyway, thank you for the great package.
I wish more commercial distribution of linux pick up apt-like
package system.
df -k -P /var/cache/apt
df -k /var/cache/apt
--
int main(void){int j=2003;/*(c)2003 cishikawa. */
char t[] ="<CI> @abcdefghijklmnopqrstuvwxyz.,\n\"";
char *i ="g>qtCIuqivb,gCwe\np@.ietCIuqi\"tqkvv is>dnamz";
while(*i)((j+=strchr(t,*i++)-(int)t),(j%=sizeof t-1),
(putchar(t[j])));return 0;}/* under GPL */
Reply to: