Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #243026 > unrolled thread

Filesystem and free space

Started byPolyna-Maude Racicot-Summerside <debian@polynamaude.com>
First post2021-12-12 20:20 +0100
Last post2021-12-13 13:20 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  Filesystem and free space Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-12-12 20:20 +0100
    Re: Filesystem and free space Teemu Likonen <tlikonen@iki.fi> - 2021-12-12 20:30 +0100
      Re: Filesystem and free space Tom Dial <tddial@comcast.net> - 2021-12-13 09:20 +0100
        Re: Filesystem and free space Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-12-13 20:20 +0100
    Re: Filesystem and free space Jonathan Dowland <jon+debian-user@dow.land> - 2021-12-13 13:20 +0100

#243026 — Filesystem and free space

FromPolyna-Maude Racicot-Summerside <debian@polynamaude.com>
Date2021-12-12 20:20 +0100
SubjectFilesystem and free space
Message-ID<DtCy5-3UD-7@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi,
I've learned thru this mailing list that it was something "from decades
ago" to create a filesystem for /tmp, /var, /home, /usr, etc unless
really needed. I must admit it make sense and I'd be better served by
either a one partition or only a /home separate.

Now here's my question :
How can I ensure that user (or a software being run by a user that goes
crazy) doesn't fill up the whole filesystem ?
I know there's quota but what I want to ensure is simply that no user
can write to disk unless there's at least 2 GB left free on partition.
Is this possible ?

Thanks
And happy new years / Christmas / whatever you do take some time off.
-- 
Polyna-Maude R.-Summerside
-Be smart, Be wise, Support opensource development

[toc] | [next] | [standalone]


#243027

FromTeemu Likonen <tlikonen@iki.fi>
Date2021-12-12 20:30 +0100
Message-ID<DtCHM-3XP-7@gated-at.bofh.it>
In reply to#243026

[Multipart message — attachments visible in raw view] — view raw

* 2021-12-12 14:13:19-0500, Polyna-Maude Racicot-Summerside wrote:

> How can I ensure that user (or a software being run by a user that
> goes crazy) doesn't fill up the whole filesystem ?

Commands mkfs.ext4 and tune2fs have this option:

    -m reserved-blocks-percentage
           Set the percentage of the filesystem which may only be
           allocated by privileged processes. Reserving some number of
           filesystem blocks for use by privileged processes is done to
           avoid filesystem fragmentation, and to allow system daemons,
           such as syslogd(8), to continue to function correctly after
           non-privileged processes are prevented from writing to the
           filesystem. Normally, the default percentage of reserved
           blocks is 5%.

See the last sentence. By default normal users can't fill the entire
space. Use tune2fs to change options for an existing file system.

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462

[toc] | [prev] | [next] | [standalone]


#243046

FromTom Dial <tddial@comcast.net>
Date2021-12-13 09:20 +0100
Message-ID<DtOIV-2U5-1@gated-at.bofh.it>
In reply to#243027

On 12/12/21 12:28, Teemu Likonen wrote:
> * 2021-12-12 14:13:19-0500, Polyna-Maude Racicot-Summerside wrote:
> 
>> How can I ensure that user (or a software being run by a user that
>> goes crazy) doesn't fill up the whole filesystem ?
> Commands mkfs.ext4 and tune2fs have this option:
> 
>     -m reserved-blocks-percentage
>            Set the percentage of the filesystem which may only be
>            allocated by privileged processes. Reserving some number of
>            filesystem blocks for use by privileged processes is done to
>            avoid filesystem fragmentation, and to allow system daemons,
>            such as syslogd(8), to continue to function correctly after
>            non-privileged processes are prevented from writing to the
>            filesystem. Normally, the default percentage of reserved
>            blocks is 5%.
> 
> See the last sentence. By default normal users can't fill the entire
> space. Use tune2fs to change options for an existing file system.

In addition, per user and per group file system quotas have been available in Unix and Linux for as long as I can remember. For Debian, see https://debian-handbook.info/browse/stable/sect.quotas.html. Man pages for mkfs.ext4, tune2fs, and edquota (and probably others) have additional relevant information. 

Regards,
Tom Dial

> 
> -- /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/ // OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462

[toc] | [prev] | [next] | [standalone]


#243072

FromPolyna-Maude Racicot-Summerside <debian@polynamaude.com>
Date2021-12-13 20:20 +0100
Message-ID<DtZ1D-Nj-9@gated-at.bofh.it>
In reply to#243046

[Multipart message — attachments visible in raw view] — view raw

Hi,


On 2021-12-13 2:47 a.m., Tom Dial wrote:
> 
> 
> On 12/12/21 12:28, Teemu Likonen wrote:
>> * 2021-12-12 14:13:19-0500, Polyna-Maude Racicot-Summerside wrote:
>>
>>> How can I ensure that user (or a software being run by a user that
>>> goes crazy) doesn't fill up the whole filesystem ?
>> Commands mkfs.ext4 and tune2fs have this option:
>>
>>     -m reserved-blocks-percentage
>>            Set the percentage of the filesystem which may only be
>>            allocated by privileged processes. Reserving some number of
>>            filesystem blocks for use by privileged processes is done to
>>            avoid filesystem fragmentation, and to allow system daemons,
>>            such as syslogd(8), to continue to function correctly after
>>            non-privileged processes are prevented from writing to the
>>            filesystem. Normally, the default percentage of reserved
>>            blocks is 5%.
>>
>> See the last sentence. By default normal users can't fill the entire
>> space. Use tune2fs to change options for an existing file system.
> 
> In addition, per user and per group file system quotas have been available in Unix and Linux for as long as I can remember. For Debian, see https://debian-handbook.info/browse/stable/sect.quotas.html. Man pages for mkfs.ext4, tune2fs, and edquota (and probably others) have additional relevant information. 
> 
Original post :


Now here's my question :
How can I ensure that user (or a software being run by a user that goes
crazy) doesn't fill up the whole filesystem ?
I know there's quota but what I want to ensure is simply that no user
can write to disk unless there's at least 2 GB left free on partition.
Is this possible ?


> Regards,
> Tom Dial
> 
>>
>> -- /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/ // OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
> 
> 

-- 
Polyna-Maude R.-Summerside
-Be smart, Be wise, Support opensource development

[toc] | [prev] | [next] | [standalone]


#243055

FromJonathan Dowland <jon+debian-user@dow.land>
Date2021-12-13 13:20 +0100
Message-ID<DtStb-5b6-1@gated-at.bofh.it>
In reply to#243026
On Sun, Dec 12, 2021 at 02:13:19PM -0500, Polyna-Maude Racicot-Summerside wrote:
>I know there's quota but what I want to ensure is simply that no user
>can write to disk unless there's at least 2 GB left free on partition.
>Is this possible ?

As another has mentioned, there's reserved-blocks-percentage at
filesystem creation time, but it only distinguishes between superuser
and not-superuser. But you could set the % such that the reserved space
was 2GiB that way.

Personally, I leave the reserved block quota at the default (which means
I can always do some basic things as root) and for the filesystems which
need reserved space to operate, I create an empty non-sparse file of the
appropriate size:

▶ stat /mnt/emergencySpace 
   File: /mnt/emergencySpace
   Size: 1073741824      Blocks: 2097152    IO Block: 4096   regular file

If/when the filesystem fills up such that the operations that need space
fail, I can quickly remove the emergencySpace file, run those operations,
and then do a deeper clean-up (removed old backup increments, or whatever
has caused the fill-up).


-- 
Please do not CC me for listmail.

👱🏻	Jonathan Dowland
✎	 jmtd@debian.org
🔗	https://jmtd.net

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web