Re: [ANNOUNCE] Btrfs: a copy on write, snapshotting FS

Chris Mason
2007-06-13T10:20:56Z

On Wed, Jun 13, 2007 at 04:08:30AM +0100, Christoph Hellwig wrote:
> On Tue, Jun 12, 2007 at 04:14:39PM -0400, Chris Mason wrote:
> > > Aside from folding snapshot history into the origin's namespace... It
> > > could be possible to have a mount.btrfs that allows subvolumes and/or
> > > snapshot volumes to be mounted as unique roots? I'd imagine a bind
> > > mount _could_ provide this too? Anyway, I'm just interested in
> > > understanding the vision for managing the potentially complex nature
> > > of a Btrfs namespace.
> >
> > One option is to put the real btrfs root into some directory in
> > (/sys/fs/btrfs/$device?) and then use tools in userland to mount -o bind
> > outside of that. I wanted to wait to get fancy until I had a better
> > idea of how people would use the feature.
>
> We already support mounting into subdirectories of a filesystem for
> nfs connection sharing. The patch below makes use of this to allow
> mounting any subdirectory of a btrfs filesystem by specifying it in
> the form of /dev/somedevice:directory and when no subdirectory
> is specified uses 'default'.

Neat, thanks Christoph, this will be much nicer longer term. I'll
integrate it after I finish off -enospc.

> To make this more useful btrfs directories
> should grow some way to be marked head of a subvolume,

They are already different in the btree, but maybe I'm not 100% sure
what you mean by marked as the head of a subvolume?

> and we'd need
> a more useful way to actually create subvolumes and snapshots without
> fugly ioctls.

One way I can think of that doesn't involve an ioctl is to have a
special subdir at the root of the subvolume:

cd
/mnt/default/.snaps
mkdir new_snapshot
rmdir old_snapshot

cd /mnt
mkdir new_subvol
rmdir old_subvol

-chris