On Thursday, 07 October, 2010, Francis Galiegue 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 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?
By design in btrfs a snapshot is "a instant, synchronized, photography of" a subvolume. In fact you can snapshot only a subvolume [*]. Moreover the subvolumes have the following properties: 1) it is possible to mount a subvolume of a filesystem: if you execute the following commands: # mount -o subvol=name-of-subvol /dev/sdxx /mn/test the kernel will use the subvolume "name-of-subvol" of the btrfs filesystem of the partition /dev/sdxx. Pay attention: this work *only* if the subvolume "name-of-subvol" is under the root of the filesystem. 2) a subvolume may be deleted asynchronously by the command "btrfs subvol delete <path>". Pay attention that the deletion is performed not instantaneous but in background. In fact even though the subvolume disappear instantaneous the space is freed during the background removing. 3) If you have a subvolume into another one, and you snapshot the latter, in the snapshot you cannot see the nested subvolume. For example you have the root ('/') under a subvolume and the /home under another subvolume. If you snapshot the root, this snapshot will not contain the subvolume /home. This may be useful if you want restore an old snapshot of 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 directory. But instead of snapshotting the directory you get a snapshot of the subvolume which contain the directory. > > -- > Francis Galiegue, fgalie...@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éphane 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 majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- gpg key@ keyserver.linux.it:Goffredo Baroncelli (ghigo) <kreijackATinwind.it> Key fingerprint = 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html