Skip to contentSkip to conversation

snapshot strange behaviour

DISCUSSION Lubos Kolouch 4 participants 7 messages Jan 23, 2011 – Jan 24, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello,

During doing backups I found strange behaviour... 2.6.37, latest btrfs- progs from git

nbgentoo ~ # btrfs subv crea a
Create subvolume './a'
nbgentoo ~ # cd a
nbgentoo a # btrfs subv crea b
Create subvolume './b'
nbgentoo a # touch b/file
nbgentoo a # ls -l b/
total 0
-rw-r--r-- 1 root root 0 Jan 23 08:14 file
nbgentoo a # cd ..
nbgentoo ~ # btrfs subv snap a x
Create a snapshot of 'a' in './x'
nbgentoo ~ # ls -l x/b/
total 0

and also

nbgentoo ~ # cd x/
nbgentoo x # btrfs subv dele b
ERROR: 'b' is not a subvolume

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolumes?

(I create subvolume backup, under this another subvolumes as not always I want to snapshot the whole backup subvolume).

Thank you

Lubos

#1 lore raw

Hi Lubos,

Quoted 20 lines · Lubos Kolouch

Hello,

During doing backups I found strange behaviour... 2.6.37, latest btrfs- progs from git

nbgentoo ~ # btrfs subv crea a
Create subvolume './a'
nbgentoo ~ # cd a
nbgentoo a # btrfs subv crea b
Create subvolume './b'
nbgentoo a # touch b/file
nbgentoo a # ls -l b/
total 0
-rw-r--r-- 1 root root 0 Jan 23 08:14 file
nbgentoo a # cd ..
nbgentoo ~ # btrfs subv snap a x
Create a snapshot of 'a' in './x'
nbgentoo ~ # ls -l x/b/
total 0

Quoted 8 lines

and also

nbgentoo ~ # cd x/
nbgentoo x # btrfs subv dele b
ERROR: 'b' is not a subvolume

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolumes?

It is the intended behavior. The snapshotting is not recursive about subvolumes. If you snapshot a subvolume which contains another one, you got only the content of the first subvolume.
The directory "x/b" which you see, is not the subvolume "b" snapshotted, but only the "mount-point" of "b".

Quoted 14 lines

(I create subvolume backup, under this another subvolumes as not always I want to snapshot the whole backup subvolume).

Thank you

Lubos

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
.

#2 lore raw

Goffredo Baroncelli, Sun, 23 Jan 2011 13:17:13 +0100:

Quoted 28 lines

Hi Lubos,

Quoted 25 lines · Lubos Kolouch

Hello,

During doing backups I found strange behaviour... 2.6.37, latest btrfs- progs from git

nbgentoo ~ # btrfs subv crea a
Create subvolume './a'
nbgentoo ~ # cd a
nbgentoo a # btrfs subv crea b
Create subvolume './b'
nbgentoo a # touch b/file
nbgentoo a # ls -l b/
total 0
-rw-r--r-- 1 root root 0 Jan 23 08:14 file nbgentoo a # cd .. nbgentoo ~ # btrfs subv snap a x
Create a snapshot of 'a' in './x'
nbgentoo ~ # ls -l x/b/
total 0

and also

nbgentoo ~ # cd x/
nbgentoo x # btrfs subv dele b
ERROR: 'b' is not a subvolume

Quoted 9 lines
Quoted 2 lines

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolumes?

It is the intended behavior. The snapshotting is not recursive about subvolumes. If you snapshot a subvolume which contains another one, you got only the content of the first subvolume. The directory "x/b" which you see, is not the subvolume "b" snapshotted, but only the "mount-point" of "b".

Hi Goffredo,

I understand. But then I think btrfs should refuse to do it or at least print a warning. Otherwise it is very inconvenient for the user, having to search for any subvolumes down the tree...

Lubos

#3 lore raw
Quoted 17 lines · Lubos Kolouch

Goffredo Baroncelli, Sun, 23 Jan 2011 13:17:13 +0100:

Quoted 5 lines

Hi Lubos,

Quoted 1 line · Lubos Kolouch

Hello,

Quoted 9 lines
Quoted 2 lines

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolumes?

It is the intended behavior. The snapshotting is not recursive about subvolumes. If you snapshot a subvolume which contains another one, you got only the content of the first subvolume. The directory "x/b" which you see, is not the subvolume "b" snapshotted, but only the "mount-point" of "b".

Quoted 5 lines

Hi Goffredo,

I understand. But then I think btrfs should refuse to do it or at least print a warning. Otherwise it is very inconvenient for the user, having to search for any subvolumes down the tree...

Sorry, but I can't agree. To me it seems a reasonable default. There are a lot of cases where I would not snapshot a sub-sub-subvolume: my rootfs is a subvolume, my home is in another one. I can snapshot, update the root fs, then if something goes wrong I can roolback to the old one, without affecting my home.

This behavior is strictly related to the btrfs internal.

Any way it is true that this behavior should be highlighted in the documentation.

And more, it is possible to add a "-R" flag to snapshot recursively a subvolume...

Goffredo

Quoted 8 lines

Lubos

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
.

#4 lore raw

Also, btrfs already has a utility to scan for subvolumes in a directory

btrfs subvolume list /path

Quoted 10 lines · Goffredo Baroncelli
Quoted 9 lines · Lubos Kolouch

Goffredo Baroncelli, Sun, 23 Jan 2011 13:17:13 +0100:

Quoted 7 lines

Hi Lubos,

Quoted 4 lines · Lubos Kolouch

Hello,

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolu=

mes?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

It is the intended behavior. The snapshotting is not recursive abou=

t

Quoted 1 line
Quoted 1 line
Quoted 1 line

subvolumes. If you snapshot a subvolume which contains another one,=

you

Quoted 1 line
Quoted 1 line
Quoted 1 line

got only the content of the first subvolume. The directory "x/b" wh=

ich

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

you see, is not the subvolume "b" snapshotted, but only the "mount-point" of "b".

Hi Goffredo,

I understand. But then I think btrfs should refuse to do it or at le=

ast

Quoted 1 line
Quoted 1 line

print a warning. Otherwise it is very inconvenient for the user, hav=

ing to

Quoted 4 lines
Quoted 1 line

search for any subvolumes down the tree...

Sorry, but I can't agree. To me it seems a reasonable default. There =

are

Quoted 1 line

a lot of cases where I would not snapshot a sub-sub-subvolume: my roo=

tfs

Quoted 6 lines

is a subvolume, my home is in another one. I can snapshot, update the root fs, then if something goes wrong I can roolback to the old one, without affecting my home.

This behavior is strictly related to the btrfs internal.

Quoted 12 lines

Any way it is true that this behavior should be highlighted in the documentation.

And more, it is possible to add a "-R" flag to snapshot recursively a subvolume...

Goffredo

Quoted 4 lines

Lubos

--
To unsubscribe from this list: send the line "unsubscribe linux-btrf=

s" in

Quoted 7 lines
Quoted 4 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html .

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 3 lines

the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Goffredo Baroncelli

Goffredo Baroncelli, Sun, 23 Jan 2011 19:02:11 +0100:

Quoted 34 lines · Lubos Kolouch
Quoted 18 lines

Goffredo Baroncelli, Sun, 23 Jan 2011 13:17:13 +0100:

Quoted 9 lines

Hi Lubos,

Quoted 5 lines · Lubos Kolouch

Hello,

Is this a bug or intended behaviour and I am missing something something? How to snapshot a subvolume, containing another subvolumes?

Quoted 7 lines

It is the intended behavior. The snapshotting is not recursive about subvolumes. If you snapshot a subvolume which contains another one, you got only the content of the first subvolume. The directory "x/b" which you see, is not the subvolume "b" snapshotted, but only the "mount-point" of "b".

Quoted 5 lines

Hi Goffredo,

I understand. But then I think btrfs should refuse to do it or at least print a warning. Otherwise it is very inconvenient for the user, having to search for any subvolumes down the tree...

Sorry, but I can't agree. To me it seems a reasonable default. There are a lot of cases where I would not snapshot a sub-sub-subvolume: my rootfs is a subvolume, my home is in another one. I can snapshot, update the root fs, then if something goes wrong I can roolback to the old one, without affecting my home.

This behavior is strictly related to the btrfs internal.

Quoted 7 lines

Any way it is true that this behavior should be highlighted in the documentation.

And more, it is possible to add a "-R" flag to snapshot recursively a subvolume...

Goffredo

The -R would be nice... two use cases :

1) directory many_small_files under the /home subvolume, that you need only for a while - it is easier to for example delete it when it is subvolume as well

2) backups

subvolume backups -> subvolumes 20110122, 20110123, ...
you want to delete backups older than x years -> it is much faster to do if it is a subvolume as well. But - you may as well want to be able snapshot or delete the whole backups subvolume.

Lubos

#6 lore raw
In reply to Goffredo Baroncelli
Quoted 2 lines · Goffredo Baroncelli

And more, it is possible to add a "-R" flag to snapshot recursively a subvolume...

Are you saying recursive snapshot creation is aready supportted in btrfs? Which version?

Signature · 1 line
Fajar