Thread (14 messages) 14 messages, 4 authors, 2021-10-21

Re: [PATCH 2/2] btrfs: sysfs add devinfo/fsid to retrieve fsid from the device

From: David Sterba <hidden>
Date: 2021-10-20 19:00:00

On Tue, Oct 19, 2021 at 08:22:10AM +0800, Anand Jain wrote:
In the case of the seed device, the fsid can be different from the mounted
sprout fsid.  The userland has to read the device superblock to know the
fsid but, that idea fails if the device is missing. So add a sysfs
interface devinfo/<devid>/fsid to show the fsid of the device.

For example:
 $ cd /sys/fs/btrfs/b10b02a5-f9de-4276-b9e8-2bfd09a578a8

 $ cat devinfo/1/fsid
 c44d771f-639d-4df3-99ec-5bc7ad2af93b
 $ cat  devinfo/3/fsid
 b10b02a5-f9de-4276-b9e8-2bfd09a578a8
How do you create such setup? I can't reproduce it.

The simplest seeding:

  mkfs.btrfs /dev/sdx
  btrfstune -S 1 /dev/sdx
  mount /dev/sdx mnt
  ... the device has the same FSID as is the sysfs directory name

With a new device and removed the seeding one:

  btrfs device add /dev/sdy mnt
  mount -o remount,rw mnt
  btrfs device delete /dev/sdx mnt
  ... both devices have the same fsid as well
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help