On Fri, Sep 25, 2020 at 8:22 AM Matti Pulkkinen <mkjpul@xxxxxx> wrote: > > Hello! > > Is there a way in the Fedora 32 installer to set the compression mount > option for a new BTRFS filesystem before installing Fedora itself? If you're familiar with kickstart, you can use '--fsoptions compress=zstd:1' This will use this option for installation and also add it to fstab. Another option is to start the installation, switch to Terminal, and 'mount -o remount,compress=zstd:1'. If you're fast, you'll beat the mkfs and initial mount, and get an error. Just up arrow and reissue the command until it works. It doesn't really have to be exact - Btrfs compression uses a maximum extent size of 128KiB. It's routine for files to have mixed compression for blocks. I > know I can add the option to the fstab file after installation, reboot, > and then run the defragment command to compress after the fact, but it > would be convenient if I could just have the filesystem compressed right > away during installation. It's fine to just add to fstab and continue on without defragmenting. As updates happen, most everything becomes compressed through attrition. > Also, from what I've read I think I already know the answer to this, but > I'll ask to make sure: is it possible to set the compression option > persistently in the filesystem itself? You can set a compression xattr per subvolume, directory and file. Inheritance works like any other xattr. There's a couple of ways to set it. The more familiar method is 'chattr +c' not to be confused with '+C' for nodatacow. Yes, it's a file attribute but it actually sets an xattr. The default compression algorithm is still zlib. So that's what you get with this method. If you want to use zstd or lzo, you'll need to use e.g. # btrfs property set -ti myfiles compression zstd # btrfs property get myfiles compression=zstd This uses the default zstd level of 3. Currently it isn't configurable, but there are patches upstream to do that eventually. >It would be nice if I could have > an external USB hard drive (with its obvious IO bottleneck) compressed > as well. However, it seems like I would then have to always manually > mount the drive with the compression option, or set the compression > attribute after mounting. Either way, this isn't persistent. I also know > I could set the disk's UUID to always be mounted with the compression > option, but that is specific to one machine. This should work, but I haven't tested it: * create a subvolume in the top-level [1] of the file system * set the compression xattr on that subvolume per either method previously described * use 'btrfs subvolume set-default /mnt/subvolume' So now when you mount this file system without any options, it'll mount this subvolume rather than the top-level, and it's set to compress everything. If for whatever reason you need to mount the top-level again, you'll do that with e.g. 'mount -o subvol=/ /dev/sdXY /mnt' [1] The top-level is jargon for the permanent, unnamed, invisible subvolume, created at mkfs time. It's ID is 0. The original default subvolume created at mkfs time has an ID of 5 for historical reasons, and later on an alias of 0 was created. Therefore its subvol name is just / as I used above; or you can use subvolid=0 or subvolid=5. So yeah, three ways to do the same thing. Whichever you're able to remember easier, they're all the same.) -- Chris Murphy _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx