On 8/2/19 5:42 PM, Hans van Kranenburg wrote:
Hi, I was just looking at btrfs property and what it can do. Now, I notice that the man page contains: label: label of device When I look at a device and ask what properties I can set, I see: -# btrfs property list -t device /dev/xvdb label Set/get label of device. But, when I try to set it, it complains: -# btrfs property set -t device /dev/xvdb label yolo ERROR: device /dev/xvdb is mounted, use mount point A mount point points to a whole filesystem, not a specific device. -# btrfs property set -t device /btrfs label yolo The result is that the label at filesystem level is set. A device doesn't even have something like a label itself. -# btrfs fi show Label: 'yolo' uuid: 370415b8-b96f-456e-8713-6833b2a65127 Total devices 4 FS bytes used 144.00KiB devid 1 size 10.00GiB used 1.00GiB path /dev/xvdb devid 2 size 10.00GiB used 1.00GiB path /dev/xvdc devid 3 size 10.00GiB used 288.00MiB path /dev/xvdd devid 4 size 10.00GiB used 288.00MiB path /dev/xvde So, am I missing something, or should this have been: -# btrfs property set -t filesystem label foo /mountpoint
Yes. Label is for the whole filesystem. Initially the label was set-able only using the device path (after mkfs), for which the device has to be in unmounted state. So when we implemented the label ioctl, so that label can be set on the mounted fs, we had to maintain its backward compatible. So at both, btrfs fi label and btrfs prop set the label works on the mount-point or the device path if its unmounted. And even if the device path is used the label is for the whole filesystem. HTH Anand
Hans
