linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Freddie Cash <fjwcash@gmail.com>
To: kreijack@inwind.it
Cc: Goffredo Baroncelli <kreijack@libero.it>,
	"krzf83@gmail.com" <krzf83@gmail.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: btrfs subvolume snapshot syntax too "smart"
Date: Mon, 4 Apr 2011 12:57:49 -0700	[thread overview]
Message-ID: <BANLkTimbmwM078e-SVcuWPDqjy99_hV+sw@mail.gmail.com> (raw)
In-Reply-To: <4D9A203E.9090807@libero.it>

On Mon, Apr 4, 2011 at 12:47 PM, Goffredo Baroncelli <kreijack@libero.i=
t> wrote:
> On 04/04/2011 09:09 PM, krzf83@gmail.com wrote:
>> I understand btrfs intent but same command run twice should not give
>> diffrent results. This really makes snapshot automation hard
>>
>>
>> root@sv12 [/ssd]# btrfs subvolume snapshot /ssd/sub1 /ssd/5
>> Create a snapshot of '/ssd/sub1' in '/ssd/5'
>> root@sv12 [/ssd]# btrfs subvolume snapshot /ssd/sub1 /ssd/5
>> Create a snapshot of '/ssd/sub1' in '/ssd/5/sub1'
>> root@sv12 [/ssd]# btrfs subvolume snapshot /ssd/sub1 /ssd/5
>> Create a snapshot of '/ssd/sub1' in '/ssd/5/sub1'
>> ERROR: cannot snapshot '/ssd/sub1'
>
> The same is true for cp:
>
> # cp -rf /ssd/sub1 /ssd/5 =C2=A0 =C2=A0 =C2=A0 -> copy "sub1" as "5"
> # cp -rf /ssd/sub1 /ssd/5 =C2=A0 =C2=A0 =C2=A0 -> copy "sub1" in "5"
>
> However you are right. It could be fixed easily adding a switch like
> "--script", which force to handle the last part of the destination as
> the name of the subvolume, raising an error if it already exists.
>
> "subvolume snapshot" is the only command which suffers of this kind o=
f
> problem ?

Isn't this a situation where supporting a trailing / would help?

=46or example, with the / at the end, means "put the snapshot into the
folder".  Thus "btrfs subvolume snapshot /ssd/sub1 /ssd/5/" would
create a "sub1" snapshot inside the 5/ folder.  Running it a second
time would error out since /ssd/5/sub1/ already exists.  And if the 5/
folder doesn't exist, it would error out.

And without the / at the end, means "name the snapshot".  Thus "btrfs
subvolume snapshot /ssd/sub1 /ssd/5" would create a snapshot named
"/ssd/5".  Running the command again would error out due to the
snapshot already existing.  And if the 5/ folder doesn't exist, it's
created.  And it errors out if the 5/ folder already exists.

Or, something along those lines.  Similar to how other apps work
with/without a trailing /.

--=20
=46reddie Cash
fjwcash@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-04-04 19:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 19:09 btrfs subvolume snapshot syntax too "smart" krzf83@gmail.com 
2011-04-04 19:47 ` Goffredo Baroncelli
2011-04-04 19:57   ` Freddie Cash [this message]
2011-04-05 14:29     ` Xavier Nicollet

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=BANLkTimbmwM078e-SVcuWPDqjy99_hV+sw@mail.gmail.com \
    --to=fjwcash@gmail.com \
    --cc=kreijack@inwind.it \
    --cc=kreijack@libero.it \
    --cc=krzf83@gmail.com \
    --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).