you are viewing a single comment's thread
view the rest of the 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)