linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* btrfs subvolume snapshot syntax too "smart"
@ 2011-04-04 19:09 krzf83@gmail.com 
  2011-04-04 19:47 ` Goffredo Baroncelli
  0 siblings, 1 reply; 4+ messages in thread
From: krzf83@gmail.com  @ 2011-04-04 19:09 UTC (permalink / raw)
  To: linux-btrfs

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'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs subvolume snapshot syntax too "smart"
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Goffredo Baroncelli @ 2011-04-04 19:47 UTC (permalink / raw)
  To: krzf83@gmail.com; +Cc: linux-btrfs

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	-> copy "sub1" as "5"
# cp -rf /ssd/sub1 /ssd/5	-> 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 of
problem ?

Regards
G.Baroncelli

> --
> 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
> .
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs subvolume snapshot syntax too "smart"
  2011-04-04 19:47 ` Goffredo Baroncelli
@ 2011-04-04 19:57   ` Freddie Cash
  2011-04-05 14:29     ` Xavier Nicollet
  0 siblings, 1 reply; 4+ messages in thread
From: Freddie Cash @ 2011-04-04 19:57 UTC (permalink / raw)
  To: kreijack; +Cc: Goffredo Baroncelli, krzf83@gmail.com, linux-btrfs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs subvolume snapshot syntax too "smart"
  2011-04-04 19:57   ` Freddie Cash
@ 2011-04-05 14:29     ` Xavier Nicollet
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Nicollet @ 2011-04-05 14:29 UTC (permalink / raw)
  To: Freddie Cash; +Cc: linux-btrfs

Le 04 avril 2011 =E0 12:57, Freddie Cash a =E9crit:
> Isn't this a situation where supporting a trailing / would help?
>=20
> For 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.
>=20
> 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.
>=20
> Or, something along those lines.  Similar to how other apps work
> with/without a trailing /.

I am not an expert, but I think it is the opposite with rsync.

Cheers,

--=20
Xavier Nicollet
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-05 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-04-05 14:29     ` Xavier Nicollet

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).