[13/17] installer: Define common mount options for BTRFS volumes

Message ID 20240315191442.3951-14-stefan.schantl@ipfire.org
State Superseded
Headers
Series BTRFS support on IPFire 2.x (experimental) |

Commit Message

Stefan Schantl March 15, 2024, 7:14 p.m. UTC
  As default we are using zstd for compression with level 1

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/installer/hw.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Michael Tremer March 18, 2024, 4:13 p.m. UTC | #1
Hello,

> On 15 Mar 2024, at 19:14, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> As default we are using zstd for compression with level 1
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> src/installer/hw.h | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/src/installer/hw.h b/src/installer/hw.h
> index 2de73a3be..402e5cd0d 100644
> --- a/src/installer/hw.h
> +++ b/src/installer/hw.h
> @@ -54,6 +54,8 @@
> 
> #define SERIAL_BAUDRATE               115200
> 
> +#define BTRFS_MOUNT_OPTIONS           "compress=zstd:1"

Is there no way to configure this in the filesystem when it is being created to be used as default?

I think it would be nicer to have a less busy /etc/fstab.

> +
> #define BYTES2MB(x) ((x) / 1024 / 1024)
> #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)
> 
> -- 
> 2.39.2
>
  
Stefan Schantl March 19, 2024, 8:19 p.m. UTC | #2
Am Montag, dem 18.03.2024 um 16:13 +0000 schrieb Michael Tremer:
> Hello,
> 
> > On 15 Mar 2024, at 19:14, Stefan Schantl
> > <stefan.schantl@ipfire.org> wrote:
> > 
> > As default we are using zstd for compression with level 1
> > 
> > Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> > ---
> > src/installer/hw.h | 2 ++
> > 1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/installer/hw.h b/src/installer/hw.h
> > index 2de73a3be..402e5cd0d 100644
> > --- a/src/installer/hw.h
> > +++ b/src/installer/hw.h
> > @@ -54,6 +54,8 @@
> > 
> > #define SERIAL_BAUDRATE               115200
> > 
> > +#define BTRFS_MOUNT_OPTIONS           "compress=zstd:1"
> 
> Is there no way to configure this in the filesystem when it is being
> created to be used as default?

SBTRFS provides the freedom to the user to tell which kind of
compression, the used algorithm and the compression ration should be
used by specifying this at mount time.

It also would be possible to change this at any later time by just
change the mount option. (This only would affect newly created files.)

So yes, it is possible to start with zstd, switch over to xz, gz and
finally uncompressed data on the same volume.

Reading through the BTRFS documentation, there is no option to
persistant set the compression details.

https://btrfs.readthedocs.io/en/latest/Compression.html 

> 
> I think it would be nicer to have a less busy /etc/fstab.

If I did not miss anything while reading the docs, we have to live with
this or disable compression.

> 
> > +
> > #define BYTES2MB(x) ((x) / 1024 / 1024)
> > #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)
> > 
> > -- 
> > 2.39.2
> > 
>
  
Michael Tremer March 22, 2024, 4:23 p.m. UTC | #3
Thought so. In that case, let’s rather have compression enabled.

> On 19 Mar 2024, at 20:19, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> Am Montag, dem 18.03.2024 um 16:13 +0000 schrieb Michael Tremer:
>> Hello,
>> 
>>> On 15 Mar 2024, at 19:14, Stefan Schantl
>>> <stefan.schantl@ipfire.org> wrote:
>>> 
>>> As default we are using zstd for compression with level 1
>>> 
>>> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
>>> ---
>>> src/installer/hw.h | 2 ++
>>> 1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/src/installer/hw.h b/src/installer/hw.h
>>> index 2de73a3be..402e5cd0d 100644
>>> --- a/src/installer/hw.h
>>> +++ b/src/installer/hw.h
>>> @@ -54,6 +54,8 @@
>>> 
>>> #define SERIAL_BAUDRATE               115200
>>> 
>>> +#define BTRFS_MOUNT_OPTIONS           "compress=zstd:1"
>> 
>> Is there no way to configure this in the filesystem when it is being
>> created to be used as default?
> 
> SBTRFS provides the freedom to the user to tell which kind of
> compression, the used algorithm and the compression ration should be
> used by specifying this at mount time.
> 
> It also would be possible to change this at any later time by just
> change the mount option. (This only would affect newly created files.)
> 
> So yes, it is possible to start with zstd, switch over to xz, gz and
> finally uncompressed data on the same volume.
> 
> Reading through the BTRFS documentation, there is no option to
> persistant set the compression details.
> 
> https://btrfs.readthedocs.io/en/latest/Compression.html
> 
>> 
>> I think it would be nicer to have a less busy /etc/fstab.
> 
> If I did not miss anything while reading the docs, we have to live with
> this or disable compression.
> 
>> 
>>> +
>>> #define BYTES2MB(x) ((x) / 1024 / 1024)
>>> #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)
>>> 
>>> -- 
>>> 2.39.2
  

Patch

diff --git a/src/installer/hw.h b/src/installer/hw.h
index 2de73a3be..402e5cd0d 100644
--- a/src/installer/hw.h
+++ b/src/installer/hw.h
@@ -54,6 +54,8 @@ 
 
 #define SERIAL_BAUDRATE               115200
 
+#define BTRFS_MOUNT_OPTIONS           "compress=zstd:1"
+
 #define BYTES2MB(x) ((x) / 1024 / 1024)
 #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)