Bug 240893 - Add ZFS Detection to fstyp(8) Tool
Summary: Add ZFS Detection to fstyp(8) Tool
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-28 11:07 UTC by vermaden
Modified: 2019-09-28 11:31 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vermaden 2019-09-28 11:07:39 UTC
Output from 12.1-BETA1:

# fstyp /dev/md0
fstyp: /dev/md0: filesystem not recognized

ZFS is not detected. Either imported or exported.

This is quick and easy way to detect ZFS on a block device:

# head -c 32000 /dev/md0 | strings | grep -q pool_guid

Dunno how that may help with fstyp(8) written in C but ...  :)

Regards.
Comment 1 Yuri Pankov freebsd_committer 2019-09-28 11:17:51 UTC
Excerpt from the fstyp(8) man page:

     When the -u flag is specified, fstyp also recognizes
     certain additional metadata formats that cannot be handled using
     mount(8), such as geli(8) providers, and ZFS pools.

So the following should work for you:

# fstyp /dev/ada0p3
fstyp: /dev/ada0p3: filesystem not recognized
# fstyp -u /dev/ada0p3
zfs
# fstyp -lu /dev/ada0p3
zfs zroot
Comment 2 vermaden 2019-09-28 11:31:50 UTC
Oh, I found -u flag ... but is that 'fread: Invalid argument' a bug?

# fstyp -u /dev/ada0p3.eli
fstyp: fread: Invalid argument
zfs
#