udiskie
udiskie copied to clipboard
Udiskie mounts each part of btrfs RAID1 array as a separate mount
Hi,
I have a RAID1 btrfs setup that has two disk parts. It looks like this:
$ lsblk -f
NAME FSTYPE FSVER LABEL UUID
sdb
└─sdb1 crypto_LUKS 2 a3674553-8613-4b93-acfe-3506f21bf280
└─luks-a3674553-8613-4b93-acfe-3506f21bf280 btrfs backup bf958e29-f40e-4665-a7c2-3d65f9db0ac3
sdd
└─sdd1 crypto_LUKS 2 490c5af3-26a8-4d4f-ae48-5def0e79c406
└─luks-490c5af3-26a8-4d4f-ae48-5def0e79c406 btrfs backup bf958e29-f40e-4665-a7c2-3d65f9db0ac3
And udiskie mounts each part separately:
$ ls media
backup backup1
It doesn't hurt but it would be enough to mount just one of them.
Notice that after unlocking both parts have the same UUID (bf958e29-f40e-4665-a7c2-3d65f9db0ac3).
By the way: big thank you for this extremely useful piece of software :heart:
Hi,
thanks for your comment! Being honest, I don't have much experience with neither RAID nor btrfs. I'm aware that RAID and LVM are currently not supported very well, and it would be awesome to change that. However, I cannot promise to have time to do that anytime soon. Contributions are welcome in these matters.
Best, Thomas
Thanks for the quick reply!
Actually I think this is well supported (I'm not quite sure about LVM RAID though). Just creates too many mount paths than necessary.
I was thinking about having an in-memory map of UUIDs to mount points and if a partition UUID is already mounted then skip mounting. In my case two partitions have the same UUID (after luks unwrapping): bf958e29-f40e-4665-a7c2-3d65f9db0ac3 so it's not necessary to mount both, just one.
That's probably the simplest solution. Not sure it works in all cases. Another one might be see if udisks provides any info on the RAID structure. Can you check if there are any relevant sections in the output of udisksctl dump, and if so, post everything belonging to it here.
It seems udisksctl dump has two sections for both physical partitions:
/org/freedesktop/UDisks2/block_devices/dm_2d2:
org.freedesktop.UDisks2.Block:
Configuration: []
CryptoBackingDevice: '/org/freedesktop/UDisks2/block_devices/sdb1'
Device: /dev/dm-2
DeviceNumber: 65026
Drive: '/'
HintAuto: false
HintIconName:
HintIgnore: false
HintName:
HintPartitionable: false
HintSymbolicIconName:
HintSystem: true
Id: by-id-dm-name-luks-a3674553-8613-4b93-acfe-3506f21bf280
IdLabel: backup
IdType: btrfs
IdUUID: bf958e29-f40e-4665-a7c2-3d65f9db0ac3
IdUsage: filesystem
IdVersion:
MDRaid: '/'
MDRaidMember: '/'
PreferredDevice: /dev/mapper/luks-a3674553-8613-4b93-acfe-3506f21bf280
ReadOnly: false
Size: 3000541101568
Symlinks: /dev/disk/by-id/dm-name-luks-a3674553-8613-4b93-acfe-3506f21bf280
/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-a367455386134b93acfe3506f21bf280-luks-a3674553-8613-4b93-acfe-3506f21bf280
/dev/disk/by-label/backup
/dev/disk/by-uuid/bf958e29-f40e-4665-a7c2-3d65f9db0ac3
/dev/mapper/luks-a3674553-8613-4b93-acfe-3506f21bf280
UserspaceMountOptions:
org.freedesktop.UDisks2.Filesystem:
MountPoints:
Size: 0
/org/freedesktop/UDisks2/block_devices/dm_2d3:
org.freedesktop.UDisks2.Block:
Configuration: []
CryptoBackingDevice: '/org/freedesktop/UDisks2/block_devices/sdd1'
Device: /dev/dm-3
DeviceNumber: 65027
Drive: '/'
HintAuto: false
HintIconName:
HintIgnore: false
HintName:
HintPartitionable: false
HintSymbolicIconName:
HintSystem: true
Id: by-id-dm-name-luks-490c5af3-26a8-4d4f-ae48-5def0e79c406
IdLabel: backup
IdType: btrfs
IdUUID: bf958e29-f40e-4665-a7c2-3d65f9db0ac3
IdUsage: filesystem
IdVersion:
MDRaid: '/'
MDRaidMember: '/'
PreferredDevice: /dev/mapper/luks-490c5af3-26a8-4d4f-ae48-5def0e79c406
ReadOnly: false
Size: 3000541101568
Symlinks: /dev/disk/by-id/dm-name-luks-490c5af3-26a8-4d4f-ae48-5def0e79c406
/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-490c5af326a84d4fae485def0e79c406-luks-490c5af3-26a8-4d4f-ae48-5def0e79c406
/dev/disk/by-label/backup
/dev/disk/by-uuid/bf958e29-f40e-4665-a7c2-3d65f9db0ac3
/dev/mapper/luks-490c5af3-26a8-4d4f-ae48-5def0e79c406
UserspaceMountOptions: uhelper=udisks2
org.freedesktop.UDisks2.Filesystem:
MountPoints: /run/media/wiktor/backup
/run/media/wiktor/backup1
Size: 0
But a funny coincidence that it sees the second partition as having two MountPoints and the first as not having any.