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.


This is at file system level… Checkout btrfs and zfs, I am quite positive both can compress like you want.
Never used this feature myself, so cannot be more specific.
Also, there are some read-only compressed filesystems for Linux that you can also use, they offer best compression but data is read only.
Okay, I’m having a bit of a problem. I tried the smallest device first but it’s too small for btrfs and I can’t figure out how to format devices in zfs. Unless xfs is the same as zfs, the option isn’t available in gparted and mkfs gives an error saying that the zfs file doesn’t exist. If it’s possible to install zfs through apt, “apt search zfs” gives a lot of results for zfs.
How small is that device??? Didn’t even knew btrfs has a minimum size.
After for zfs, you probably have to install some software or kernel patches
It’s 128 MB, brtfs needs at least 256 MB. Also yes, I’m aware that I’d need to install something to use zfs but I don’t know where to look to find out what I’d need to install.
Huh. My computer allows me to format a 128MB image file with brtfs. It won’t do it at 64MB though.
deleted by creator
Good call. Seems minimum for ZFS is three quarters of a Gigabyte, anyway. And definitely not made for what OP does 😆
How are you trying to format the device? I got that error message when using gparted.
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/loop0p1You 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.
If it’s a flash memory (sd card, usb stick, ssd, etc), you could try f2fs, it’s very light, and it supports compression and is meant specifically for that kind of devices (well, more for ssds).
But judging your experience from your comments, I suggest you don’t delve into niche filesystems until you have more experience with Linux, especially for something like 128MB. I especially suggest you avoid zfs for now.
Huh. My computer allows me to format a 128MB image file with brtfs. It won’t do it at 64MB though.
Xfs and zfs are two different filesystems.
Okay, I can try both of those out.