Jump to content

Help needed - compression level for btrfs file system on my ubuntu 23.10

Go to solution Solved by Eigenvektor,
10 hours ago, johnny45 said:

im not sure if im reading it right if the lzo line means ther compression enabled

Yes, it does. Btrfs currently supports three different compression algorithms: ZLIB, LZO and ZSTD. LZO doesn't compress as well as ZLIB or ZSTD and has no levels, but it is faster. ZSTD requires at least btrfs 4.14 to work, and if you want to use levels you need btrfs 5.1.

 

So the first thing to check would be if you're using btrfs 5.1 or newer, so you can use ZSTD and you can specify compression levels.

 

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

 

Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       79%     1.4G         1.8G         1.9G

This line tells you that, on average, files are compressed down to 79% of their original size. They use 1.4G on disk, their uncompressed size would be 1.8G

 

none       100%      1.0G         1.0G         1.0G

This line tells you there are 1G of files on your drive that were not compressed by btrfs. So the size on disk is 100% of their original size.

 

These would be files where compression is not worth it, most likely because they are already compressed, e.g. files such as .rar, .zip, .7z, .jpg, .png, .mp3, .mpeg, .mkv, etc. Effectively any file format that is compressed internally. See: https://btrfs.readthedocs.io/en/latest/Compression.html#incompressible-data

 

lzo         53%      446M         833M         843M

This line tells you that files compressed with lzo could, on average, be compressed down to 53% of their original file size. They use 446M on disk and would take 833M when uncompressed.

 

10 hours ago, johnny45 said:

this is what my fstab file looks like

It would be a easier to work with if you used a code tag, rather than an image. You can simply redact the UUIDs there (though there's no real reason to). In any case, you need to set "compress=zstd:4" where it currently says "defaults". Those are the mount options. It's a bit easier to see what you're doing if you align the contents with the comment at the very top.

 

# <file system>  <mount point>  <type>  <options>         <dump>  <pass>
UUID=<redacted>  /              btrfs   compress=zstd:4   0       2

 

more mount options: https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#man-btrfs5-mount-options

five questions i need help with

 

q1.
how do i check to see what compression level my btrfs file system on my ubuntu 23.10 system is using ?

 

q2.
how do i add an change its level an apply it to the whole system (id like to set level 4) ?

 

q3.
what the correct way to add/edit it into the fstab file ?

 

q4.
how do i check why compression level my zstd setting is at an how do i set it higher if i want ?

 

q5.
with zstd compression algorithem can i set it to level 5 an have work when i select it in a gui app like xarchiver
an if so how would i do that ?

 


when i type in the terminal
man compsize i get this

 

compsize(8)                     btrfs                    compsize(8)

NAME
compsize  -  calculate compression ratio of a set of files on

 

btrfs

 

SYNOPSIS

 

compsize file‐or‐dir [ file‐or‐dir ... ]

 

Processed 90319 files.

 

Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       79%      1.4G         1.8G         1.9G
none       100%      1.0G         1.0G         1.0G
lzo         53%      446M         833M         843M

____________________________________________________

im not sure if im reading it right if the lzo line means ther compression enabled
but wither it is or not id like to set for the main an 2nd nvme ssds in


my rig the compression to be zstd at level 4 an some step by step help on how to do that
this is what my fstab file looks like

an how an were do i add the compress=zstd line ?

Link to comment
Share on other sites

Link to post
Share on other sites

What type of data are you looking to store? There's a good chance large files (such as movies) are already compressed.

 

Which means compression on the file system level is unlikely to save you much space, if any.

 

You also need to consider that higher compression level generally means more work to compress/decompress so it might actually make file access slower, depending on how fast your CPU is.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

mostlt data,apps,pics, an few games an other miscellaneous stuff

all my uncompressed audio an video files some compressed vids are all stored on exturnel nas

 

 

but like i stated

 

im not sure if im reading it right if the lzo line means ther compression enabled
but wither it is or not id like to set for the main an 2nd nvme ssds in


my rig the compression to be zstd at level 4 an some step by step help on how to do that
this is what my fstab file looks like

an how an were do i add the compress=zstd line ?

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, johnny45 said:

im not sure if im reading it right if the lzo line means ther compression enabled

Yes, it does. Btrfs currently supports three different compression algorithms: ZLIB, LZO and ZSTD. LZO doesn't compress as well as ZLIB or ZSTD and has no levels, but it is faster. ZSTD requires at least btrfs 4.14 to work, and if you want to use levels you need btrfs 5.1.

 

So the first thing to check would be if you're using btrfs 5.1 or newer, so you can use ZSTD and you can specify compression levels.

 

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

 

Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       79%     1.4G         1.8G         1.9G

This line tells you that, on average, files are compressed down to 79% of their original size. They use 1.4G on disk, their uncompressed size would be 1.8G

 

none       100%      1.0G         1.0G         1.0G

This line tells you there are 1G of files on your drive that were not compressed by btrfs. So the size on disk is 100% of their original size.

 

These would be files where compression is not worth it, most likely because they are already compressed, e.g. files such as .rar, .zip, .7z, .jpg, .png, .mp3, .mpeg, .mkv, etc. Effectively any file format that is compressed internally. See: https://btrfs.readthedocs.io/en/latest/Compression.html#incompressible-data

 

lzo         53%      446M         833M         843M

This line tells you that files compressed with lzo could, on average, be compressed down to 53% of their original file size. They use 446M on disk and would take 833M when uncompressed.

 

10 hours ago, johnny45 said:

this is what my fstab file looks like

It would be a easier to work with if you used a code tag, rather than an image. You can simply redact the UUIDs there (though there's no real reason to). In any case, you need to set "compress=zstd:4" where it currently says "defaults". Those are the mount options. It's a bit easier to see what you're doing if you align the contents with the comment at the very top.

 

# <file system>  <mount point>  <type>  <options>         <dump>  <pass>
UUID=<redacted>  /              btrfs   compress=zstd:4   0       2

 

more mount options: https://btrfs.readthedocs.io/en/latest/btrfs-man5.html#man-btrfs5-mount-options

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

thanks that breakdown really help thanks

 

one thing tho how excatly do i check what version of btrfs im running ?

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, johnny45 said:

one thing tho how excatly do i check what version of btrfs im running ?

Google tells me Ubuntu 23.10 uses kernel version 6.5 at the moment, so basically you have btrfs 6.5. Before kernel version 2.6.32 btrfs had an independent version number, now it simply uses the same version number as the kernel.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

23 hours ago, johnny45 said:

thanks that breakdown really help thanks

 

one thing tho how excatly do i check what version of btrfs im running ?

Just check your kernel version

 

uname-r

Link to comment
Share on other sites

Link to post
Share on other sites

question using nano edit i added the  btrfs   compress=zstd:4 line in place of the default in the fstab file an rebooted but how can i tell if its enabled an working ?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×