From: Eric Sandeen <sandeen@redhat.com>
To: kreijack@inwind.it, linux-btrfs <linux-btrfs@vger.kernel.org>
Cc: jshubin@redhat.com
Subject: Re: [PATCH] mkfs.btrfs: allow UUID specification at mkfs time
Date: Wed, 14 May 2014 09:41:19 -0500 [thread overview]
Message-ID: <5373808F.4020403@redhat.com> (raw)
In-Reply-To: <5373803E.9000406@libero.it>
On 5/14/14, 9:39 AM, Goffredo Baroncelli wrote:
> Hi Eric,
>
> On 05/14/2014 03:18 AM, Eric Sandeen wrote:
>> Allow the specification of the filesystem UUID at mkfs time.
>
> I suggest to add some warning when this options is used, because the
> behavior could be very different than the one expected.
>
> I suspect that BTRFS tracks the filesystem by UUID and not by
> devices. When two filesystems have the same UUID at the same time, it
> may mount the wrong one.
Well, of course if you explicitly create two "universally unique identifiers"
which are not actually unique, you can shoot yourself in the foot.
"Here's enough rope to hang yourself with" is a proud tradition in
the Unix world. ;)
> $ #
> $ # Make two *different* filesystems with the *same* UUID
> $ #
> $ UUID=e285c9bd-ea97-40b3-ad7d-8713dcfd5eea
> $ sudo ./mkfs.btrfs -f -U $UUID /dev/vdg
> $ sudo ./mkfs.btrfs -f -U $UUID /dev/vdh
>
> $ #
> $ # from the beginning "btrfs fi show" reports wrong information
> $ #
> $ sudo btrfs fi show
> Label: none uuid: e285c9bd-ea97-40b3-ad7d-8713dcfd5eea
> Total devices 1 FS bytes used 96.00KB
> devid 1 size 50.00GB used 4.00MB path /dev/vdh
> devid 1 size 50.00GB used 2.04GB path /dev/vdg
>
> $ #
> $ # mount the first one, create a new file then un-mount it
> $ #
> $ sudo mount /dev/vdg /mnt/btrfs1
> $ sudo touch /mnt/btrfs1/dev-vdg
> $ sudo umount /dev/vdg
>
> $ #
> $ # mount the second one, it should be empty
> $ # instead btrfs mount the first one
> $ #
> $ sudo mount /dev/vdh /mnt/btrfs2
> $ ls -l /mnt/btrfs2
> total 0
> -rw-r--r-- 1 root root 0 May 14 16:12 dev-vdg
o_O ok, that's a little unexpected.
>
> I am not against this option; I am suggesting to add a explicit
> warning to the user about the risk of doing that, both on the man
> pages and into the program. The warning should say that this option
> is only for testing. Better ask for a confirmation (even with an
> undocumented switch like
> '--I-know-that-I-am-doing-something-really-dangerous').
meh. ext4 and xfs have had the ability to either set or change the
UUID for years, and I've not heard of any horror stories.
>
> For the record, BTRFS seems unable to mount at the same time two different filesystems with the same UUID:
>
> $ #
> $ # try to mount two fs with the same UUID, but BTRFS doesn't allow it
> $ #
> $ sudo mount /dev/vdh /mnt/btrfs2
> $ sudo mount /dev/vdg /mnt/btrfs1
> ERROR: mount failed : 16 - Device or resource busy
(presumably the kernel said something, too?)
and this seems to make it even more safe.
-Eric
>
> BR
> G.Baroncelli
>
next prev parent reply other threads:[~2014-05-14 14:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 1:18 [PATCH] mkfs.btrfs: allow UUID specification at mkfs time Eric Sandeen
2014-05-14 7:31 ` Wang Shilong
2014-05-14 12:25 ` Brendan Hide
2014-05-14 13:34 ` Duncan
2014-05-14 14:42 ` James Shubin
2014-05-14 13:28 ` Eric Sandeen
2014-05-14 13:34 ` David Pottage
2014-05-14 14:39 ` Goffredo Baroncelli
2014-05-14 14:41 ` Eric Sandeen [this message]
2014-05-14 15:14 ` Goffredo Baroncelli
2014-05-14 15:27 ` David Sterba
2014-05-14 14:47 ` James Shubin
2014-05-14 15:35 ` [PATCH V2] " Eric Sandeen
2014-05-14 16:01 ` David Sterba
2014-05-14 16:09 ` Eric Sandeen
2014-05-14 16:52 ` Goffredo Baroncelli
2014-05-14 17:39 ` PATCH V3] " Eric Sandeen
2014-05-14 22:04 ` Goffredo Baroncelli
2014-05-14 22:07 ` Eric Sandeen
2014-05-15 17:39 ` David Sterba
2014-05-15 17:53 ` Eric Sandeen
2014-05-16 17:24 ` David Sterba
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=5373808F.4020403@redhat.com \
--to=sandeen@redhat.com \
--cc=jshubin@redhat.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).