you are viewing a single comment's thread
view the rest of the comments
[+] [S] 3 points 6 months ago (16 children)
  • [–] 8 points 6 months ago (14 children)

    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

  • source
  • parent
  • hideshow 14 child comments
  • [+] [S] 4 points 6 months ago (14 children)
  • [–] 6 points 6 months ago (6 children)

    Huh. My computer allows me to format a 128MB image file with brtfs. It won't do it at 64MB though.

  • source
  • parent
  • hideshow 6 child comments
  • [+] [S] 2 points 6 months ago (5 children)
  • [–] 3 points 6 months ago* (last edited 6 months ago) (4 children)
    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.

  • source
  • parent
  • hideshow 4 child comments
  • [+] [S] 3 points 6 months ago (4 children)
  • [–] 2 points 6 months ago* (3 children)

    Remember to enable compression. 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.

  • source
  • parent
  • hideshow 3 child comments
  • [+] [S] 1 point 6 months ago (3 children)
  • [–] 1 point 6 months ago (2 children)

    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=*

  • source
  • parent
  • hideshow 2 child comments
  • [+] [S] 2 points 6 months ago* (2 children)
  • [–] 2 points 6 months ago* (last edited 6 months ago) (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [+] [S] 1 point 6 months ago (1 child)
  • [–] 2 points 6 months 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.

  • source
  • parent
  • load more comments (-1 replies)
  • load more comments (-1 replies)
  • load more comments (-1 replies)
  • load more comments (-1 replies)
  • load more comments (-2 replies)
  • [–] 5 points 6 months ago (4 children)

    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.

  • source
  • parent
  • hideshow 4 child comments
  • [+] [S] 2 points 6 months ago (3 children)
  • [–] 3 points 6 months ago* (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [+] [S] 1 point 6 months ago (2 children)
  • [–] 4 points 6 months ago* (last edited 6 months ago) (1 child)

    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.

    P.s. apparently compsize is btrfs only. You can use "du" with and without --apparent-size and check the differenze

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (-1 replies)
  • load more comments (-1 replies)
  • load more comments (-1 replies)
  • [–] 1 point 6 months ago

    Damn, where did you even find such a small drive? The last time I used such a small device was the USB stick I brought to highschool in 2009. Even the free giveaway USB drives I have are at least 2GB. You probably have more RAM than storage?

  • source
  • parent
  • load more comments (-1 replies)