From: George Mitchell <george@chinilu.com>
To: Karel Zak <kzak@redhat.com>, util-linux@vger.kernel.org
Subject: Re: umount and findmnt commands not working with btrfs labels ...
Date: Thu, 09 May 2013 07:06:28 -0700 [thread overview]
Message-ID: <518BAD64.6080704@chinilu.com> (raw)
In-Reply-To: <20130509094226.GD17527@x2.net.home>
So what I think I hear you saying on this issue is that though I can
easily turn a label into a mount point with my little grep trick, umount
is unable to do that so that in my scripts I will always have to use
this kluge for things to work correctly? And that of course the same
would hold true with findmnt?
On 05/09/2013 02:42 AM, Karel Zak wrote:
> On Tue, May 07, 2013 at 07:48:40AM -0700, George Mitchell wrote:
>> problem. Is there a different debug statement I can use with findmnt? What
> LIBMOUNT_DEBUG= for libmount
> LIBBLKID_DEBUG= for libblkid
>
> We usually use /dev/disk/by-label and by-uuid/ to convert LABELs and
> UUIDs to device names. These symlinks are maintained by udevd and
> created according to result from
>
> blkid -o udev -p <device>
>
> the duplicate LABELs are ignored, there is only one LABEL of course.
>
>> fix or whether I will need to redo this with each reboot? Also you did your
>> testing with a simple one partition btrfs volume. My system involves up to
> I had two independent partitions, each initialized by mkfs.btrfs.
>
>> five partitions in a single RAID 1 volume. My boot volume is spread over
>> two partitions. I am wondering if that could have something to do with it?
>> In any case, here is what I come up with using the same debug prefix with
>> findmnt.
> Ah, do you mean btrfs raid? For example:
>
> mkfs.btrfs --data raid1 --label FOO /dev/sdd1 /dev/sdd2
>
> then the LABEL and UUID is really duplicate.
>
>
> Anyway, the right way how to umount any filesystem is to specify the
> filesystem by mountpoint, for example
>
> umount /mnt
>
> this is the way how Linux umount(2) syscall works, because everything
> else is unreliable. Don't forget that you can mount the same filesystem
> on more places and sometimes filesystem != device (e.g. btrfs), etc.
>
> The umount-by-device is marked in the umount(8) man page as obsolete.
> It seems I have to add a note about RAIDs too.
>
>> Using findmnt on MAGEIA3BTR-BOOT produces the following. It appears to find
>> the mount point and then print the result:
>>
>> [root@localhost ghmitch]# LIBMOUNT_DEBUG=0xffff findmnt
>> LABEL=MAGEIA3BTR-BOOT
> [...]
>> However, when I do the same operation with MAGEIA3BTR, it DOES seem to find
>> the mount point (4814: libmount: CACHE: [0x861c8a0]: add entry [ 1]
>> (tag): /dev/sdd1: LABEL). The problem is, that is NOT the mount point. The
>> mount point is /dev/sde1.
> It seems that we need a note about duplicate LABELs to the man page ;-)
>
> Note, for Linux RAID (mdadm(8)) we're able to detect that the
> filesystem is within a raid member device (e.g. /dev/sda<N>) and the
> device is reported as RAID member, the filesystem is ignored. The
> filesystem is visible only on the final raid device (e.g /dev/md0).
>
> It means that the duplicate filesystems (RAID1 members) are invisible.
>
>
> I guess something like this is unnecessary for btrfs, because you can
> mount arbitrary btrfs raid member (device) as btrfs kernel code is
> able to find the next raid members and compose the final array.
>
>> Here is my blkid which will give you an overview of the partitions involved.
>> NOTE that with btrfs there are often multiple partitions with the same LABEL
>> and UUID, but only ONE of those will be the mount point and that mount point
>> can change at any time to one of the OTHER partitions sharing the same
>> label. If umount OR findmnt happen to get the wrong mountpoint even with
>> the right label, things are not going to work out:
> So I don't see a bug. All what we need is to more explicitly explain
> to users that conversion from <device|uuid|label> to <mountpoint> is
> not reliable, because the same device could be mounted on more places
> or the mountpoint could be connected to more devices.
>
>> /dev/sda5: LABEL="MAGEIA3BTR-BOOT" UUID="63f13151-dd34-45e1-b40d-7ed7d0d0ec4a" UUID_SUB="978f5c02-5e11-4df4-8f72-4ff6d09e58ff" TYPE="btrfs"
>> /dev/sdb5: LABEL="MAGEIA3BTR-BOOT" UUID="63f13151-dd34-45e1-b40d-7ed7d0d0ec4a" UUID_SUB="0587a676-8bad-4d61-a8af-0e262d997ba7" TYPE="btrfs"
> Yes, I see.
>
> Karel
>
>
next prev parent reply other threads:[~2013-05-09 14:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 22:28 umount and findmnt commands not working with btrfs labels George Mitchell
2013-05-07 9:48 ` Karel Zak
2013-05-07 14:10 ` George Mitchell
2013-05-07 14:48 ` George Mitchell
2013-05-09 9:42 ` Karel Zak
2013-05-09 14:06 ` George Mitchell [this message]
2013-05-09 18:53 ` Karel Zak
2013-05-09 16:01 ` George Mitchell
2013-05-09 16:59 ` Helmut Hullen
2013-05-09 19:07 ` Karel Zak
2013-05-09 19:54 ` Roger Leigh
2013-05-10 0:15 ` George Mitchell
2013-05-10 8:28 ` Karel Zak
2013-05-07 15:10 ` George Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=518BAD64.6080704@chinilu.com \
--to=george@chinilu.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox