linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can you please define "snapshot" and "subvolume"?
@ 2010-10-07 11:39 Francis Galiegue
       [not found] ` <AANLkTinGvkLSNq3xiOA5R777k54wbjfgDRKjXwJx0_fW@mail.gmail.com>
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Francis Galiegue @ 2010-10-07 11:39 UTC (permalink / raw)
  To: linux-btrfs

I have difficulties grabbing these two concepts.

As far as I can tell, a snapshot is an instant, synchronized,
photography of the filesystem at a given point in time; a subvolume is
a "subroot" to a btrfs filesystem.

While I fully understand (and use) the purpose of snapshots, I don't
quite fathom the use case for subvolumes, apart from btrfs-convert...
Why has btrfs grown such a feature in the first place? Can someone
give me a use case for them?

--=20
=46rancis Galiegue, fgaliegue@gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (St=C3=A9phane Faroult, in "Th=
e
Art of SQL", ISBN 0-596-00894-5)
--
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] 12+ messages in thread

* Can you please define "snapshot" and "subvolume"?
       [not found] ` <AANLkTinGvkLSNq3xiOA5R777k54wbjfgDRKjXwJx0_fW@mail.gmail.com>
@ 2010-10-07 12:00   ` Benjamin Griese
  0 siblings, 0 replies; 12+ messages in thread
From: Benjamin Griese @ 2010-10-07 12:00 UTC (permalink / raw)
  To: linux-btrfs

You may take a look at this article
this isn't actually a explanation of why snapshots or subvolumes are
used, but maybe you can read the importance of the difference from the
context:
http://www.h-online.com/open/features/Snapshots-and-subvolumes-747029.h=
tml

On Thu, Oct 7, 2010 at 13:39, Francis Galiegue <fgaliegue@gmail.com> wr=
ote:
>
> I have difficulties grabbing these two concepts.
>
> As far as I can tell, a snapshot is an instant, synchronized,
> photography of the filesystem at a given point in time; a subvolume i=
s
> a "subroot" to a btrfs filesystem.
>
> While I fully understand (and use) the purpose of snapshots, I don't
> quite fathom the use case for subvolumes, apart from btrfs-convert...
> Why has btrfs grown such a feature in the first place? Can someone
> give me a use case for them?
>
> --
> Francis Galiegue, fgaliegue@gmail.com
> "It seems obvious [...] that at least some 'business intelligence'
> tools invest so much intelligence on the business side that they have
> nothing left for generating SQL queries" (St=E9phane Faroult, in "The
> Art of SQL", ISBN 0-596-00894-5)
> --
> 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 =A0http://vger.kernel.org/majordomo-info.html



--
To be or not to be -- Shakespeare | To do is to be -- Nietzsche | To
be is to do -- Sartre | Do be do be do -- Sinatra




--
To be or not to be -- Shakespeare | To do is to be -- Nietzsche | To
be is to do -- Sartre | Do be do be do -- Sinatra
--
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] 12+ messages in thread

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 11:39 Can you please define "snapshot" and "subvolume"? Francis Galiegue
       [not found] ` <AANLkTinGvkLSNq3xiOA5R777k54wbjfgDRKjXwJx0_fW@mail.gmail.com>
@ 2010-10-07 12:30 ` Jérôme Poulin
  2010-10-07 13:18   ` Mike Hommey
  2010-10-07 18:08 ` Goffredo Baroncelli
  2010-10-07 20:48 ` David Nicol
  3 siblings, 1 reply; 12+ messages in thread
From: Jérôme Poulin @ 2010-10-07 12:30 UTC (permalink / raw)
  To: Francis Galiegue; +Cc: linux-btrfs

Just to tell you one of my use case, I do compilations of OpenWRT on a
Btrfs filesystem, when I snapshot, I only snapshot the subvolume where
all the sources are instead of the whole root filesystem, and when I
need a snapshot of the root for backup purposes, only the root without
all the snapshot (which are used to compile for different models of
embedded devices) is snapshotted, which probably reduces the overhead
(I can't tell for sure) and makes deletion instantaneous, the cleaner
just wipes behind the subvolume remove command.

On Thu, Oct 7, 2010 at 7:39 AM, Francis Galiegue <fgaliegue@gmail.com> =
wrote:
> I have difficulties grabbing these two concepts.
>
> As far as I can tell, a snapshot is an instant, synchronized,
> photography of the filesystem at a given point in time; a subvolume i=
s
> a "subroot" to a btrfs filesystem.
>
> While I fully understand (and use) the purpose of snapshots, I don't
> quite fathom the use case for subvolumes, apart from btrfs-convert...
> Why has btrfs grown such a feature in the first place? Can someone
> give me a use case for them?
>
> --
> Francis Galiegue, fgaliegue@gmail.com
> "It seems obvious [...] that at least some 'business intelligence'
> tools invest so much intelligence on the business side that they have
> nothing left for generating SQL queries" (St=E9phane Faroult, in "The
> Art of SQL", ISBN 0-596-00894-5)
> --
> 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 =A0http://vger.kernel.org/majordomo-info.html
>
--
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] 12+ messages in thread

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 12:30 ` Jérôme Poulin
@ 2010-10-07 13:18   ` Mike Hommey
  2010-10-07 14:00     ` Benjamin Griese
  2010-10-07 20:52     ` David Nicol
  0 siblings, 2 replies; 12+ messages in thread
From: Mike Hommey @ 2010-10-07 13:18 UTC (permalink / raw)
  To: Jérôme Poulin; +Cc: Francis Galiegue, linux-btrfs

On Thu, Oct 07, 2010 at 08:30:31AM -0400, J=E9r=F4me Poulin wrote:
> Just to tell you one of my use case, I do compilations of OpenWRT on =
a
> Btrfs filesystem, when I snapshot, I only snapshot the subvolume wher=
e
> all the sources are instead of the whole root filesystem, and when I
> need a snapshot of the root for backup purposes, only the root withou=
t
> all the snapshot (which are used to compile for different models of
> embedded devices) is snapshotted, which probably reduces the overhead
> (I can't tell for sure) and makes deletion instantaneous, the cleaner
> just wipes behind the subvolume remove command.

BTW, it would be very useful to be able to turn existing directories
into subvolumes.

Mike
--
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] 12+ messages in thread

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 13:18   ` Mike Hommey
@ 2010-10-07 14:00     ` Benjamin Griese
  2010-10-07 20:52     ` David Nicol
  1 sibling, 0 replies; 12+ messages in thread
From: Benjamin Griese @ 2010-10-07 14:00 UTC (permalink / raw)
  To: Mike Hommey; +Cc: Jérôme Poulin, Francis Galiegue, linux-btrfs

+1 from me

On Thu, Oct 7, 2010 at 15:18, Mike Hommey <mh@glandium.org> wrote:
> On Thu, Oct 07, 2010 at 08:30:31AM -0400, J=E9r=F4me Poulin wrote:
>> Just to tell you one of my use case, I do compilations of OpenWRT on=
 a
>> Btrfs filesystem, when I snapshot, I only snapshot the subvolume whe=
re
>> all the sources are instead of the whole root filesystem, and when I
>> need a snapshot of the root for backup purposes, only the root witho=
ut
>> all the snapshot (which are used to compile for different models of
>> embedded devices) is snapshotted, which probably reduces the overhea=
d
>> (I can't tell for sure) and makes deletion instantaneous, the cleane=
r
>> just wipes behind the subvolume remove command.
>
> BTW, it would be very useful to be able to turn existing directories
> into subvolumes.
>
> Mike
> --
> 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 =A0http://vger.kernel.org/majordomo-info.html
>



--=20
To be or not to be -- Shakespeare | To do is to be -- Nietzsche | To
be is to do -- Sartre | Do be do be do -- Sinatra
--
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] 12+ messages in thread

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 11:39 Can you please define "snapshot" and "subvolume"? Francis Galiegue
       [not found] ` <AANLkTinGvkLSNq3xiOA5R777k54wbjfgDRKjXwJx0_fW@mail.gmail.com>
  2010-10-07 12:30 ` Jérôme Poulin
@ 2010-10-07 18:08 ` Goffredo Baroncelli
  2010-10-07 20:48 ` David Nicol
  3 siblings, 0 replies; 12+ messages in thread
From: Goffredo Baroncelli @ 2010-10-07 18:08 UTC (permalink / raw)
  To: linux-btrfs

On Thursday, 07 October, 2010, Francis Galiegue wrote:
> I have difficulties grabbing these two concepts.
>=20
> As far as I can tell, a snapshot is an instant, synchronized,
> photography of the filesystem at a given point in time; a subvolume i=
s
> a "subroot" to a btrfs filesystem.
>=20
> While I fully understand (and use) the purpose of snapshots, I don't
> quite fathom the use case for subvolumes, apart from btrfs-convert...
> Why has btrfs grown such a feature in the first place? Can someone
> give me a use case for them?

By design in btrfs a snapshot is "a instant, synchronized, photography =
of" a=20
subvolume.
In fact you can snapshot only a subvolume [*].=20

Moreover the subvolumes have the following properties:

1) it is possible to mount a subvolume of a filesystem: if you execute =
the=20
following commands:

# mount -o subvol=3Dname-of-subvol /dev/sdxx /mn/test

the kernel will use the subvolume "name-of-subvol" of the btrfs filesys=
tem of=20
the partition /dev/sdxx. Pay attention: this work *only* if the subvolu=
me=20
"name-of-subvol" is under the root of the filesystem.

2) a subvolume may be deleted asynchronously by the command "btrfs subv=
ol=20
delete <path>". Pay attention that the deletion is performed not instan=
taneous=20
but in background. In fact even though the subvolume disappear instanta=
neous=20
the space is freed during the background removing.

3) If you have a subvolume into another one, and you snapshot the latte=
r, in=20
the snapshot you cannot see the nested subvolume.=20
=46or example you have the root ('/') under a subvolume and the /home u=
nder=20
another subvolume. If you snapshot the root, this snapshot will not con=
tain=20
the subvolume /home. This may be useful if you want restore an old snap=
shot of=20
the root filesystem without affecting the users homes directories.

In the future some attributes (raid mode, compression) may be set per-
subvolume basis.

Regards
G.Baroncelli


[*] The btrfsctl utility doesn't return an error when you snapshot a=20
directory. But instead of snapshotting the directory you get a snapshot=
 of the=20
subvolume which contain the directory.
>=20
> --=20
> Francis Galiegue, fgaliegue@gmail.com
> "It seems obvious [...] that at least some 'business intelligence'
> tools invest so much intelligence on the business side that they have
> nothing left for generating SQL queries" (St=C3=A9phane Faroult, in "=
The
> Art of SQL", ISBN 0-596-00894-5)
> --
> 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
>=20


--=20
gpg key@ keyserver.linux.it:Goffredo Baroncelli (ghigo) <kreijackATinwi=
nd.it>
Key fingerprint =3D 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
--
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] 12+ messages in thread

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 11:39 Can you please define "snapshot" and "subvolume"? Francis Galiegue
                   ` (2 preceding siblings ...)
  2010-10-07 18:08 ` Goffredo Baroncelli
@ 2010-10-07 20:48 ` David Nicol
  3 siblings, 0 replies; 12+ messages in thread
From: David Nicol @ 2010-10-07 20:48 UTC (permalink / raw)
  To: Francis Galiegue; +Cc: linux-btrfs

On Thu, Oct 7, 2010 at 6:39 AM, Francis Galiegue <fgaliegue@gmail.com> wrote:
> While I fully understand (and use) the purpose of snapshots, I don't
> quite fathom the use case for subvolumes, apart from btrfs-convert...
> Why has btrfs grown such a feature in the first place? Can someone
> give me a use case for them?

I'm new here; I trust that someone will correct me if wrong:

As I understand it, since snapshotting works on volumes, having
subvolumes allows a smaller thing that you can take a snapshot of. A
use case? One could give each user on a multi-user system their own
subvolume rather than their own directory, under /home/... and then
take snapshots of these home directories to implement regular backups
(1)without duplicating unchanged files and (2) with independence
between the users.

As to why they exist, I understand that they began as an
implementation detail of snapshots, rather than their creation having
been driven by the needs of a particular use case, and one could
legitimately criticize currently offered use cases (such as the one
above) as contrived.

I believe it is fair to consider a new subvolume as equivalent of a
snapshot of an empty file system.

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

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 13:18   ` Mike Hommey
  2010-10-07 14:00     ` Benjamin Griese
@ 2010-10-07 20:52     ` David Nicol
  2010-10-07 21:13       ` Goffredo Baroncelli
  1 sibling, 1 reply; 12+ messages in thread
From: David Nicol @ 2010-10-07 20:52 UTC (permalink / raw)
  To: Mike Hommey; +Cc: Jérôme Poulin, Francis Galiegue, linux-btrfs

On Thu, Oct 7, 2010 at 8:18 AM, Mike Hommey <mh@glandium.org> wrote:
> BTW, it would be very useful to be able to turn existing directories
> into subvolumes.

does a (link,unlink) move work across subvolumes?

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

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 20:52     ` David Nicol
@ 2010-10-07 21:13       ` Goffredo Baroncelli
  2010-10-07 21:14         ` Chester
  2010-10-09  8:15         ` Mike Hommey
  0 siblings, 2 replies; 12+ messages in thread
From: Goffredo Baroncelli @ 2010-10-07 21:13 UTC (permalink / raw)
  To: linux-btrfs

On Thursday, 07 October, 2010, David Nicol wrote:
> On Thu, Oct 7, 2010 at 8:18 AM, Mike Hommey <mh@glandium.org> wrote:
> > BTW, it would be very useful to be able to turn existing directories
> > into subvolumes.
> 
> does a (link,unlink) move work across subvolumes?

The link across subvolumes is not allowable.  In the beginning it was 
possible, but that was source of bugs. See the thread "Hard link across 
subvolumes"

http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03286.html


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


-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

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

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 21:13       ` Goffredo Baroncelli
@ 2010-10-07 21:14         ` Chester
  2010-10-09  8:15         ` Mike Hommey
  1 sibling, 0 replies; 12+ messages in thread
From: Chester @ 2010-10-07 21:14 UTC (permalink / raw)
  To: kreijack; +Cc: linux-btrfs

If I were to use the defrag option in btrfsctl,
$ btrfsctl -d /
would it also defragment the subvolumes under the root?

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

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-07 21:13       ` Goffredo Baroncelli
  2010-10-07 21:14         ` Chester
@ 2010-10-09  8:15         ` Mike Hommey
  2010-10-09 13:55           ` Goffredo Baroncelli
  1 sibling, 1 reply; 12+ messages in thread
From: Mike Hommey @ 2010-10-09  8:15 UTC (permalink / raw)
  To: Goffredo Baroncelli; +Cc: linux-btrfs

On Thu, Oct 07, 2010 at 11:13:18PM +0200, Goffredo Baroncelli wrote:
> On Thursday, 07 October, 2010, David Nicol wrote:
> > On Thu, Oct 7, 2010 at 8:18 AM, Mike Hommey <mh@glandium.org> wrote:
> > > BTW, it would be very useful to be able to turn existing directories
> > > into subvolumes.
> > 
> > does a (link,unlink) move work across subvolumes?
> 
> The link across subvolumes is not allowable.  In the beginning it was 
> possible, but that was source of bugs. See the thread "Hard link across 
> subvolumes"
> 
> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03286.html

But couldn't cp --reflink be made to work?

Mike

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

* Re: Can you please define "snapshot" and "subvolume"?
  2010-10-09  8:15         ` Mike Hommey
@ 2010-10-09 13:55           ` Goffredo Baroncelli
  0 siblings, 0 replies; 12+ messages in thread
From: Goffredo Baroncelli @ 2010-10-09 13:55 UTC (permalink / raw)
  To: Mike Hommey; +Cc: linux-btrfs

On Saturday, 09 October, 2010, you (Mike Hommey) wrote:
> On Thu, Oct 07, 2010 at 11:13:18PM +0200, Goffredo Baroncelli wrote:
> > On Thursday, 07 October, 2010, David Nicol wrote:
> > > On Thu, Oct 7, 2010 at 8:18 AM, Mike Hommey <mh@glandium.org> wrote:
> > > > BTW, it would be very useful to be able to turn existing directories
> > > > into subvolumes.
> > > 
> > > does a (link,unlink) move work across subvolumes?
> > 
> > The link across subvolumes is not allowable.  In the beginning it was 
> > possible, but that was source of bugs. See the thread "Hard link across 
> > subvolumes"
> > 
> > http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg03286.html
> 
> But couldn't cp --reflink be made to work?
> 
I don't know why, but I can confirm that in the btrfs kernel source it is 
checked the case that the "reflink" is preformed between two subvolume. And in 
this case this action is denied.

http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-
unstable.git;a=blob;f=fs/btrfs/ioctl.c;h=9254b3d58dbef22974af3c7c61dbc9a4af7a33b6;hb=HEAD#l1489

-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

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

end of thread, other threads:[~2010-10-09 13:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 11:39 Can you please define "snapshot" and "subvolume"? Francis Galiegue
     [not found] ` <AANLkTinGvkLSNq3xiOA5R777k54wbjfgDRKjXwJx0_fW@mail.gmail.com>
2010-10-07 12:00   ` Benjamin Griese
2010-10-07 12:30 ` Jérôme Poulin
2010-10-07 13:18   ` Mike Hommey
2010-10-07 14:00     ` Benjamin Griese
2010-10-07 20:52     ` David Nicol
2010-10-07 21:13       ` Goffredo Baroncelli
2010-10-07 21:14         ` Chester
2010-10-09  8:15         ` Mike Hommey
2010-10-09 13:55           ` Goffredo Baroncelli
2010-10-07 18:08 ` Goffredo Baroncelli
2010-10-07 20:48 ` David Nicol

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