*Edit: I have figured out how to use BTRFS and enable what it calls “transparent file compression”, and I’m going to use that on most of my old storage devices. The only problem I’m having is that I want to use F2FS on my oldest storage device, as BTRFS takes up too much space on the device and I was told by multiple users that F2FS also supports transparent file compression, but I can’t get files to compress and I’m not getting any error messages to try and fix it. Based on what the documentation says, I’m supposed to do something like this:

sudo mkfs.f2fs -f -O extra_attr,inode_checksum,sb_checksum,compression /dev/mmcblk0p1
sudo mount -o compress_algorithm=zstd,compress_extension=* /dev/mmcblk0p1 '/home/j/mountpoint/128mb'
chattr -R +c '/home/j/mountpoint/128mb'

The device will mount like this but files aren’t compressing when added, nor are they compressed if using the last command after they’ve been moved.*

I’m rewriting the old portion for clarification:

In Windows, there’s a file/folder option called “compress to save space”. What it does is it compresses the files, as the name suggests, but leaves them accessible as though they aren’t. This doesn’t really have much of a benefit on newer storage devices but on older storage devices, in addition to saving space, it allows files to potentially read faster.

As I have some old storage devices that I want to run games from, I think this will be a great option to have if I could find something similar for Linux. I tried looking online myself but search engines are terrible and I couldn’t find anything though them. So, I decided to post about this here, to see if anyone knows of anything I could try.

  • vortexal@lemmy.mlOP
    link
    fedilink
    arrow-up
    3
    ·
    7 hours ago

    I got brtfs working on a different storage device but I can’t tell if I set it up properly or not. I’m using the documentation that another user posted but it’s a bit confusing to me and I need to test it more.

    For my 128 MB sd card, I am trying f2fs because that’s working. It does seem to write much faster than it did with ext4 but it seems to take up more space and it now has about 25% less free space, and it doesn’t seem to compress files. I’ll have to do more testing before I determine whether this what I go with or not.

    As for squashfs, I probably don’t want that.

    • hendrik@palaver.p3x.de
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      7 hours ago

      Remember to enable it. Usually the Arch Wiki is a great resource to learn stuff: https://wiki.archlinux.org/title/F2FS

      And don’t forget to back up your data if you’re messing around with your computer. One typo with the device names is enough to accidentally delete your harddrive.

      • vortexal@lemmy.mlOP
        link
        fedilink
        arrow-up
        1
        ·
        6 hours ago

        I figured out what I did wrong but now I’m getting a different error. It’s saying “Error: Wrong features compress_algorithm=zstd” even though the page you linked to specifies that that should be possible.

      • vortexal@lemmy.mlOP
        link
        fedilink
        arrow-up
        1
        ·
        7 hours ago

        I tried to enable compression using the command they provide but it fails with an error saying “Error: Failed to get the device stat!”. Also, to make sure that I’m using the correct command line, how would I change the command they give to enable zstd as the compression method for all files.

        • hendrik@palaver.p3x.de
          link
          fedilink
          English
          arrow-up
          1
          ·
          6 hours ago

          I haven’t tried it. But looks to me you need to add “compression” when formatting it. And then later when mounting, you’d add options like compress_algorithm=zstd,compress_extension=*

          • vortexal@lemmy.mlOP
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            5 hours ago

            I actually figure out the problem, I was actually supposed to just enable compression and then use the command when mounting. Only problem is, it’s not compressing the files even though I mounted it with zstd enabled. I know this because I’m using a file that’s slightly larger than the free space but it’s still giving errors about not having enough space.

            • hendrik@palaver.p3x.de
              link
              fedilink
              English
              arrow-up
              2
              ·
              edit-2
              5 hours ago

              Did you read the Wiki? You need to either pass the compress_extension option when mounting it. The Arch Wiki lists how to enable compression on all text files. And I gave you the version with a ‘*’, which enables compression for all files. Or you do a chattr -R +c ... on specific files or directories to compress them. Maybe you missed that and that’s why it doesn’t compress?!

              There’s probably also a way to debug it and somehow figure out what it does and how many files/sectors got compressed on the filesystem. Linux usually buries that kind of information somewhere in /sys or /proc, or there’s special commands to figure it out. But I’m not really an expert on it.

              And there’s also files which just can not be compressed any further because they’re already compressed. Most images, for example. Or music or ZIP archives. If you try to compress those, they’ll usually stay the same size.

              • vortexal@lemmy.mlOP
                link
                fedilink
                arrow-up
                1
                ·
                5 hours ago

                Nope, I just reformatted sd card back to f2fs, mounted it the way both you and the documentation specified, and files are still not being compressed.

              • vortexal@lemmy.mlOP
                link
                fedilink
                arrow-up
                1
                ·
                5 hours ago

                No I did read it, I did the commands like it said but files weren’t being compressed. I can try it again though, if it turns out I did still do something wrong.

                Also, I tried formatting the sd card to btrfs without using gparted and it did work, and files are being compressed. Only problem is is that btrfs is using about 2/3 of the cd card, so I hope I can get f2fs working on it.

                • hendrik@palaver.p3x.de
                  link
                  fedilink
                  English
                  arrow-up
                  2
                  ·
                  5 hours ago

                  Sounds reasonable. Yeah, good luck. I’m sure you’ll figure it out. Unfortunately it’s always a bit difficult to diagnose problems over the internet, without typing in the commands and seeing the exact output. But there should be a way to make it work, F2FS is designed for something like this.