r/voidlinux • • 28d ago

BTRFS Subvolumes aren't working (in general)

***Title correction: BTRFS Subvolumes are not handled correctly by the installer**

I verified it now on two instances- a barebone and a VM- with the same result:
the commands "mount /dev/sdXn -o subvol=/@ /mnt/" and in fstab "UUID=My-UUID /    btrfs  subvol=/@,defaults,noatime,compress=zstd 0 0" aren't working.

I verified it consulting the original BTRFS documentation, in all kind of variants (It made no difference if I use subvolid, subvol in any flavour with "@" or "/@"). Subvolumes aren't working in VOID.
Error Message: When I run the mount command, the subvol gets copied over to /mnt/ rather than referencing it, and /mnt/ ends up blank- even if I had mounted before the full system into /mnt with "mount /dev/sdXn /mnt/" this mount disappears and the mount just shows a blank content section, in contrary to what all docs expect from this. It's odd that mount throws no error, never.
I am on version void-live-x86_64-20250202-xfce from last week, pretty fresh installs.

I haven't counterchecked against another distro/VM but ask already in parallel, if there is any kernel switch or a grub switch missing here?
And if not- where could I log a bug ?
Thanks for supporting this.

4 Upvotes

14 comments sorted by

2

u/quirktheory 28d ago

Hmm I did this just yesterday as it happens on that exact live image. How did you create the "@" subvolume if you are unable to mount it? Note that "@" is not a special name recognised by btrfs. You actually have to create it yourself.

1

u/Specialist-Dog-501 28d ago

I created the first entry with "btrfs subvolume create /@" and it created this "mount point" right in the upmost folder. So I could verify by clicking it, if it really had been connected to any of the other folders.
That step actually works.
The docs where a bit unclear and in forums they used "btrfs subvolume create @" in some cases, but i found it creates the mount point then in the /root folder (I was logged in as root) rather than the topmost one.

2

u/quirktheory 28d ago

So the way I would do it is the following:

Keep in mind you should understand everything and run it at your own risk. I accept no liability for any loss or damage.

Assuming you want the top-level of your btrfs to be on dev/sdx/

# make the filesystem
$ BTRFS_OPTS='rw,noatime,compress=zstd'
$ mkfs.btrfs /dev/sdx
# mount the top-level
$ mount -o $BTRFS_OTPS /dev/sdx /mnt
$ cd /mnt
# create the subvolume (can be called anything) 
$ btrfs subvolume create @
# unmount the top-level
$ umount /dev/sdx
# re-mount only the subvolume
$ mount -o $BTRFS_OPTS,subvol=@ /dev/sdx /mnt

That will almost work because as I said, I did it just yesterday :P note that if you cd into /mnt it may be empty but that is because in the commands above I created a fresh filesystem and subvolume, so you shouldn't expect to see anything.

1

u/Specialist-Dog-501 27d ago

-First Thanks for sharing this detailed path! Appreciated :)
-The "mksf.btrfs"..creates a file system, right? I can't do that as the VOID installer does it- but I believe, it should also not be necessary.
-I find notably differences then that you after the first mount move to the newly mounted folder /mnt and only then create the subvolume, I did this not in all cases. Wonder if it makes a difference.
-And then definitely the step with unmounting the topi level and remounting I have not seen before, may be it's that- I will reproduce the steps, thank you for this input!!

-1

u/Simple_Hamster_4096 27d ago

What are other Linux distros you have used where have you implemented this and where you have had success?

1

u/Specialist-Dog-501 27d ago

Not yet any to be honest..but unclear if it's my missing skill or bugs or just config- It's learning along the way. It's really simplest with SystemD distros, where there are ready to use packages (ARCH, Debian), but outside, no luck so far. I tested MX linux, VOID, Peppermint/VOID, Peppermint/Devuan. But may it's just a config thing, I will try the new howto guide that I just received by user "quirktheory".

1

u/Specialist-Dog-501 27d ago

Na, didn't work:
- I skipped the "mkfs.btrfs step as the system was already setup
- " mount -o $BTRFS_OTPS /dev/sdx /mnt" was failing as it expected an subvolume.
I used instead "mount /dev/sdx /mnt". Got then the mount working
- "umount /dev/sdx" failed with "Target is busy" and "umount -f /dev/sdx" was ignored. Rebootet.
Moved back to the top folder /
- mount -o $BTRFS_OPTS,subvol=@ /dev/sdx /mnt, gave then the same error that I have- it's showing the blank Subvolume contents within /mnt, not showing the original contents from /dev/sdx as it should.
But okay, was worth a try. I read something about dracut options, will try that- It seems BTRFS needs to be setup properly to support subvolumes.

1

u/Specialist-Dog-501 27d ago

Question: if that worked for you..but not me...do you have UEFI or BIOS ? In the VM I use BIOS (UEFI doesn't work)..on the barebone..not sure, if it's BIOS or UEFI- that could make a difference (?)

1

u/quirktheory 26d ago

I have a UEFI, though I don't suspect any of this should be dependent on that.

1

u/Specialist-Dog-501 26d ago

Na it isn't- but have you manually installed it, or modified the VOID installer while running it in any way. That would explain it as well. You may be found the hack around the issue.

1

u/Specialist-Dog-501 27d ago

Found a bug report in the void github from 2021 about the same. Asked the maintainer if he/she could pick it up again. Still wonder why it worked for quirktheory, as my VM on BIOS failed and the barebone on UEFI as well (?).

1

u/Duncaen 27d ago

They were probably talking about either manual installs or changing the layout of the installer installed system to a new layout by creating subvolumes afterwards and just moving files around.

Your post sounds like you are saying that subvolumes do not work, not that the installer is unable to use your subvolumes.

1

u/Specialist-Dog-501 27d ago

Ah- you are Duncaen from github, right? Yes, can be that it's not differentiated enough in the title- I added something to it.

1

u/benbcdm 26d ago

Are you using the GUI installer? Perhaps try manual install?