All of lore.kernel.org
 help / color / mirror / Atom feed
* Determining subvolumes
@ 2012-12-26 13:38 Gene Czarcinski
  2012-12-26 13:55 ` Hugo Mills
  0 siblings, 1 reply; 3+ messages in thread
From: Gene Czarcinski @ 2012-12-26 13:38 UTC (permalink / raw)
  To: linux-btrfs

I know that I can find out what btrfs "volumes" are on a system with the 
command:
      btrfs  fi  show

I can also check if a partition of disk is a btrfs volume with the command:
      blkid  -o value -s TYPE /dev/<disk|partition>

And, if I mount that btrfs volume with something like:
      mount -t btrfs /dev/<btrfs>  /mnt/btrfs

The, I can get a list of btrfs subvolumes on that volume with the command:
      btrfs  subvolume  list  /mnt/btrfs

My question:  Is there a way of finding out what subvolumes are defined 
on a btrfs volume without mounting the volume?

Gene

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

* Re: Determining subvolumes
  2012-12-26 13:38 Determining subvolumes Gene Czarcinski
@ 2012-12-26 13:55 ` Hugo Mills
  2013-01-03 16:12   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Hugo Mills @ 2012-12-26 13:55 UTC (permalink / raw)
  To: Gene Czarcinski; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On Wed, Dec 26, 2012 at 08:38:54AM -0500, Gene Czarcinski wrote:
> I know that I can find out what btrfs "volumes" are on a system with
> the command:
>      btrfs  fi  show
> 
> I can also check if a partition of disk is a btrfs volume with the command:
>      blkid  -o value -s TYPE /dev/<disk|partition>
> 
> And, if I mount that btrfs volume with something like:
>      mount -t btrfs /dev/<btrfs>  /mnt/btrfs
> 
> The, I can get a list of btrfs subvolumes on that volume with the command:
>      btrfs  subvolume  list  /mnt/btrfs
> 
> My question:  Is there a way of finding out what subvolumes are
> defined on a btrfs volume without mounting the volume?

   No. (Well, in theory the code is possible, but there's nothing I'm
aware of that will do it)

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
              --- Python is executable pseudocode; perl ---              
                        is executable line-noise.                        

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: Determining subvolumes
  2012-12-26 13:55 ` Hugo Mills
@ 2013-01-03 16:12   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2013-01-03 16:12 UTC (permalink / raw)
  To: Hugo Mills, Gene Czarcinski, linux-btrfs

On Wed, Dec 26, 2012 at 01:55:13PM +0000, Hugo Mills wrote:
> On Wed, Dec 26, 2012 at 08:38:54AM -0500, Gene Czarcinski wrote:
> > I know that I can find out what btrfs "volumes" are on a system with
> > the command:
> >      btrfs  fi  show
> > 
> > I can also check if a partition of disk is a btrfs volume with the command:
> >      blkid  -o value -s TYPE /dev/<disk|partition>
> > 
> > And, if I mount that btrfs volume with something like:
> >      mount -t btrfs /dev/<btrfs>  /mnt/btrfs
> > 
> > The, I can get a list of btrfs subvolumes on that volume with the command:
> >      btrfs  subvolume  list  /mnt/btrfs
> > 
> > My question:  Is there a way of finding out what subvolumes are
> > defined on a btrfs volume without mounting the volume?
> 
>    No. (Well, in theory the code is possible, but there's nothing I'm
> aware of that will do it)

It is possible to work with the filesystem offline, but lots of the
useful code is written only in kernel module (and accessed via ioctl()
calls from userspace).

Listing the subvolumes consists of:

* opening the filesystem (open_ctree_fs_info)
* search root tree for all ROOT_ITEM (via btrfs_search_slot)
  and also the found items recursively
* resolve the full path for each given root id (normally done via
  BTRFS_IOC_INO_LOOKUP) - btrfs_search_path_in_tree could be used almost
  verbatim (is not present in progs)

The existing functions to list subvolumes would need enhancing to work
both online and offline (eg. the filtering and printing code coud be
shared).

I don't know how far we should go to allow friendly access to an offline
volume. For debugging purposes it's usually enough to grep through
output of btrfs-debug-tree. Simple tasks like listing subvolumes or
manipulating default subvolume do not sound like a bad use case.


david

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

end of thread, other threads:[~2013-01-03 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-26 13:38 Determining subvolumes Gene Czarcinski
2012-12-26 13:55 ` Hugo Mills
2013-01-03 16:12   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.