Hopefully this is my final edit before getting a full solution but I just want to say that if you are going to either resort to belittling me for not using better/newer hardware or you make it obvious that you haven’t fully read the post before commenting, I’m not going to respond to your comment.

In Windows, there’s a file/folder option called “Compress contents to save disk 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.

Edit: I have figured out how to use BTRFS and enable what it calls “transparent file compression”. Games are running decently well and I’m able to run games that are much larger than the devices original capacity (it seems to be around 2 to 2.5 times the original free space, on average), so I’m going to use that on most of my old storage devices at least for the time being. 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 that device.

When formatted to BTRFS, there’s only about 40MB of free space and with compression it can hold around 100MB worth of files. Meanwhile, there’s about 80MB of free space with F2FS and I was told by multiple users that F2FS also supports transparent file compression, which should get me around 200MB worth of files on that device because it’s documented to support the same compression methods as BTRFS. But I can’t get files to compress and I’m not getting any error messages to try and diagnose the problem. 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.

  • edinbruh@feddit.it
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    1 day ago

    So, first of all, there is no gui for this, that I’m aware of, so you will have to do it from terminal. Second, on f2fs, compression works that you don’t enable compression for a folder, instead you mount the drive with compression enabled, and new files will be compressed automatically.

    So what you need is to set up your disk to be mounted with compression. There are many paths you can follow here. If you want your drive to be (almost) permanently connected, the easiest way is to use “/etc/fstab”. If you want to use it as a regular SD card, mounting and ejecting it from your file explorer etcetera, then you should go here and learn how to have udisks2 mount your device with compression, which should be what your desktop environment uses to mount drives. I suggest you set that up for your specific device, and not for all f2fs devices. Good luck.

    You can look up other useful f2fs options on the arch wiki. I suggest you add all those options that reduces writes to your disk and improve durability (like lazytime).

    You should use zstd as compression algorithm, and because this is a slow and small drive, you can crank up the level of compression.

    If you manage to pull this off, the next time you install a (bigger and faster) drive on your pc, you can try to look into zfs.

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

      I read the page you linked to but I have no idea what I’m supposed to do with it. If it’s talking about using the “mount” command, I’ve already used that and even though I specifically enabled zstd as the compression method, files aren’t being compressed. 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.

      • edinbruh@feddit.it
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        1 day ago

        That is not a good method for testing. Maybe the filesystem still requires new files to be smaller than free space. Or maybe the file could be not really compressible, for example, you won’t be able to compress random data. You also won’t compress already compressed data, like videos.

        You could write a real text file of some kB and then check the compression ratio with something like “compsize”.

        The mount command mounts the disk with the options you give to it but only once. Now, because you don’t want to manually run mount everytime you use your disk, you must set it up so it is always mounted with the options you want. Udisks2 is one of the tools for that.

        edit: apparently compsize is btrfs only. You can use “du” with and without --apparent-size and check the differenze

        • vortexal@lemmy.mlOP
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          1 day ago

          I used a folder full of smaller files and it still isn’t compressing them. I’ve tried everything I can find or was told to do with f2fs but I cannot for the life of me, get files to compress. Btrfs works and files are compressing but it takes up so much space on the sd card.

          • edinbruh@feddit.it
            link
            fedilink
            English
            arrow-up
            1
            ·
            22 hours ago

            I have a similar setup and it works. So you are probably doing something wrong, I don’t know what. Maybe look at dmesg for a filesystem error.

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

              I checked dmesg and there’s no errors. As I said in my post, I’m not getting any error messages, so I have nothing to diagnose the problem with.