All of lore.kernel.org
 help / color / mirror / Atom feed
* query btrfs creation options
@ 2013-04-24 20:00 Rich Turner
  2013-04-24 20:59 ` Jérôme Poulin
  2013-04-24 23:38 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Rich Turner @ 2013-04-24 20:00 UTC (permalink / raw)
  To: linux-btrfs

i am looking for a way to query btrfs filesystems for all options used to create the filesystem 
(i.e. data, leafsize, label, metadata, nodesize, sectorsize) in an effort to be able to record this 
information and be able to recreate the filesystem with the same attributes if necessary.

i see there is a feature request for creating an api/library that may provide this functionality, 
but i am unable to find any suitable userspace command that provides the information.

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

* Re: query btrfs creation options
  2013-04-24 20:00 query btrfs creation options Rich Turner
@ 2013-04-24 20:59 ` Jérôme Poulin
  2013-04-24 23:38 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Jérôme Poulin @ 2013-04-24 20:59 UTC (permalink / raw)
  To: Rich Turner; +Cc: linux-btrfs

I think actual userland tools should be able to do what you want;
leafsize, nodesize, sectorsize: btrfs-show-super /dev/dm-6
label: blkid /dev/dm-6
data, metadata: btrfs filesystem df /

# btrfs-show-super /dev/dm-6
superblock: bytenr=65536, device=/dev/dm-6
---------------------------------------------------------
csum 0xba41e65b [match]
bytenr 65536
flags 0x1
magic _BHRfS_M [match]
fsid 456e363c-650e-4c29-898c-b2b65bf9c3b3
label p4-btrfs2
generation 253003
root 664749473792
sys_array_size 97
chunk_root_generation 218142
root_level 1
chunk_root 131072
chunk_root_level 0
log_root 0
log_root_transid 0
log_root_level 0
total_bytes 536869732352
bytes_used 441861300224
sectorsize 4096
nodesize 65536
leafsize 65536
stripesize 4096
root_dir 6
num_devices 1
compat_flags 0x0
compat_ro_flags 0x0
incompat_flags 0x29
csum_type 0
csum_size 4
cache_generation 253003
dev_item.uuid 5a5802fb-5012-4bae-897e-388754b5ed08
dev_item.fsid 456e363c-650e-4c29-898c-b2b65bf9c3b3 [match]
dev_item.type 0
dev_item.total_bytes 536869732352
dev_item.bytes_used 446689181696
dev_item.io_align 4096
dev_item.io_width 4096
dev_item.sector_size 4096
dev_item.devid 1
dev_item.dev_group 0
dev_item.seek_speed 0
dev_item.bandwidth 0
dev_item.generation 0


On Wed, Apr 24, 2013 at 4:00 PM, Rich Turner <rturner@storix.com> wrote:
> i am looking for a way to query btrfs filesystems for all options used to
> create the filesystem (i.e. data, leafsize, label, metadata, nodesize,
> sectorsize) in an effort to be able to record this information and be able
> to recreate the filesystem with the same attributes if necessary.
>
> i see there is a feature request for creating an api/library that may
> provide this functionality, but i am unable to find any suitable userspace
> command that provides the information.
> --
> 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] 3+ messages in thread

* Re: query btrfs creation options
  2013-04-24 20:00 query btrfs creation options Rich Turner
  2013-04-24 20:59 ` Jérôme Poulin
@ 2013-04-24 23:38 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2013-04-24 23:38 UTC (permalink / raw)
  To: Rich Turner; +Cc: linux-btrfs

On Wed, Apr 24, 2013 at 01:00:02PM -0700, Rich Turner wrote:
> i am looking for a way to query btrfs filesystems for all options used to
> create the filesystem (i.e. data, leafsize, label, metadata, nodesize,
> sectorsize) in an effort to be able to record this information and be able
> to recreate the filesystem with the same attributes if necessary.

the 'file' utility is able to give you the leaf/node/sector numbers

$ file -s /dev/sda5
/dev/sda5: BTRFS Filesystem sectorsize 4096, nodesize 4096, leafsize 4096)

I don't have the label set, but it is printed if set.

The raid profiles can be obtained from 'btrfs fi df', this should be
enough to recreate the fs.

> i see there is a feature request for creating an api/library that may
> provide this functionality, but i am unable to find any suitable userspace
> command that provides the information.

'file' parses the superblock directly, but we could enhance the
ioctl BTRFS_IOC_FS_INFO to get it in an api-friendly way.

david

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

end of thread, other threads:[~2013-04-24 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 20:00 query btrfs creation options Rich Turner
2013-04-24 20:59 ` Jérôme Poulin
2013-04-24 23:38 ` 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.