You are not logged in.

#1 2021-04-20 20:55:02

kozlek
Member
Registered: 2021-04-20
Posts: 2

Btrfs and auto-mount issue

Hi !

I just installed Archlinux on a new computer and I decided to try Btrfs.
My OS drive is

 /dev/nvme0n1 

, partitionned this way:

  1. BIOS Boot Partition

  2. EFI System Partition

  3. Linux Btrfs

The Btrfs partition contains two subvolumes:

  • /@root

  • /@swap

Everything is mounted this way:

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3
UUID=71491f6f-22f2-4da0-82f5-9d4a5871d5f9       /               btrfs           rw,relatime,ssd,space_cache,subvolid=256,subvol=/@root,subvol=@root     0 0

# /dev/nvme0n1p2 LABEL=EFI
UUID=8409-787B                                  /efi            vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro   0 2

# /dev/nvme0n1p3
UUID=71491f6f-22f2-4da0-82f5-9d4a5871d5f9       /swap           btrfs           rw,relatime,ssd,space_cache,subvolid=257,subvol=/@swap,subvol=@swap     0 0

/swap/swapfile                                  none            swap            defaults        0 0

Everything is working well ; system is booting without errors and I'm able to auto mount when needed using

mount -a

Then I wanted to try RAID 1 capability of Btrfs, using two spare drives.
I chose a partitionless setup:

 mkfs.btrfs -d raid1 -m raid1 -L "NVMe Data" /dev/nvme1n1 /dev/nvme2n1 

Then I created two subvolumes:

  • /@postgres

  • /@clickhouse

And I appended the following to my fstab:

# @postgres
UUID=d91798c7-a5fc-401a-a34c-59cfc371611a       /var/lib/postgres       btrfs   rw,relatime,ssd,space_cache,subvolid=258,subvol=/@postgres     0 0
# @clickhouse
UUID=d91798c7-a5fc-401a-a34c-59cfc371611a       /var/lib/clickhouse     btrfs   rw,relatime,ssd,space_cache,subvolid=259,subvol=/@clickhouse   0 0

After a restart, the subvolumes were properly mounted. However, each

 mount -a 

while the subvolumes are already mounted will lead to an error:

mount: /var/lib/postgres: /dev/nvme2n1 already mounted or mount point busy.
mount: /var/lib/clickhouse: /dev/nvme2n1 already mounted or mount point busy.

In my understanding of mount, it should not raise an error if the subvolume are already mounted. Am I missing something ?

I'm using 5.11.15-arch1-2 and I disabled my postgres & clickhouse servers to prevent any files usage from these path.

Thanks for your help.

Offline

#2 2021-04-20 21:07:25

kozlek
Member
Registered: 2021-04-20
Posts: 2

Re: Btrfs and auto-mount issue

After further testing, it looks like mount doesn't like the usage of UUID for RAID1 Btrfs ...
Replacing UUID=d91798c7-a5fc-401a-a34c-59cfc371611a by either /dev/nvme1n1 or /dev/nvme2n1 does the tricks but I would prefer to use UUID...

Offline

#3 2021-04-21 01:24:29

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Btrfs and auto-mount issue

I don't know about your actual problem. It should work with UUID.

Something else:

You should remove all of those "subvolid=..." mount options you are using. Use only "subvol=...".


EDIT:

I think I understand what's going on now: you are right now confused about what subvolumes are and how they work. You seem to have created your new postgres and clickhouse subvolumes inside your "UUID=71491f6f-22f2-4da0-82f5-9d4a5871d5f9" filesystem. You need to mount your "UUID=d91798c7-a5fc-401a-a34c-59cfc371611a" filesystem and then create the postgres etc. subvolumes inside that filesystem.

Also, I guess you'll want to name your subvolume "@var@lib@postgres" because you'll mount it to "/var/lib/postgres"? I don't know how that naming scheme works that uses "@" characters. I thought the "@" is supposed to mean "/" so a "@postgres" name means you mount something to "/postgres"? The "@" characters are somehow important for software like timeshift and you use timeshift? Maybe you can find something in the timeshift documentation about what they want you to do with the "@" characters. The only thing I could find is that timeshift cares about subvolumes "@" and "@home" for "/" and "/home". Maybe it doesn't care about any other subvolume so you don't really need those "@" characters for your postgres subvolume? I would then just call it "postgres" without that weird "@".

Last edited by Ropid (2021-04-21 01:38:39)

Offline

#4 2021-04-21 09:45:41

adventurer
Member
Registered: 2014-05-04
Posts: 119

Re: Btrfs and auto-mount issue

Ropid wrote:

You seem to have created your new postgres and clickhouse subvolumes inside your "UUID=71491f6f-22f2-4da0-82f5-9d4a5871d5f9" filesystem. You need to mount your "UUID=d91798c7-a5fc-401a-a34c-59cfc371611a" filesystem and then create the postgres etc. subvolumes inside that filesystem.

Yes, I agree.

Offline

Board footer

Powered by FluxBB