As I mentioned in the title, I’m not looking to save space, I want to test something. In Windows, you could use this option on a folder and still access the contents and run executables while keeping the folder and it’s contents compressed. The benefit to doing this, outside of saving space, is that files could potentially be accessed faster on slower storage devices.

As I’ve been trying to get the most out of some old storage devices I have, I think that something like this would be a great option for this. The only problem is that I’ve tried looking online for a way to do this but search engines are terrible. So, I’m posting about this here in case someone knows of a way to do this.

Edit: I forgot to specify this but I’m trying this for gaming. I know it’s not recommended to this but as a result, I mostly need something that’s not read-only. It might work fine for some games but this obviously wont work for all games.

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    2 hours ago
    truncate -s 128M fs.img  
    parted fs.img  
      mklabel gpt  
      mkpart primary btrfs 1MiB 100%  
      quit  
    sudo losetup --find --partscan --show fs.img  
    sudo mkfs.btrfs /dev/loop0p1  
    

    You should be able to skip the loop device stuff and work on an actual device instead. Seems to me the limit is somewhere between 64M and 128M.

    Edit: But as edinbruh said, maybe try f2fs if it’s a flash device, that’s probably a bit more lightweight?! And since I don’t know what you’re doing… If it’s embedded stuff and you’re alright with read-only, you might want to use squashfs.

    • vortexal@lemmy.mlOP
      link
      fedilink
      arrow-up
      3
      ·
      1 hour 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
        1 hour 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
          ·
          26 minutes 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
          ·
          1 hour 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
            ·
            16 minutes 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
              1
              ·
              49 seconds 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.