# blkid



## balanga (Aug 6, 2014)

I recently came across a program called blkid on Linux. There is no such command on FreeBSD. I tried `pkg install blkid` but failed to find it.

If it does exist how do I install it?


----------



## balanga (Aug 6, 2014)

In reply to my own post, I found:-

http://www.freshports.org/misc/e2fsprogs-libblkid/

and added the pkg as per instructions.

Unfortunately when I run *blkid* I still get 'Command not found.'

What am I missing?


----------



## junovitch@ (Aug 6, 2014)

`cd /usr/ports; grep -R blkid *`

```
...
sysutils/e2fsprogs/pkg-plist:man/man8/blkid.8.gz
sysutils/e2fsprogs/pkg-plist:sbin/blkid
```

It would seem that `blkid` is including the pkg-plist file of sysutils/e2fsprogs.  Looking at that port, it uses the library you installed automatically.  So you don't need to install that package you installed as it will be used automatically.  Just `pkg install e2fsprogs` should be enough.


----------



## SirDice (Aug 7, 2014)

You can always tell what a particular package installed: `pkg info -l e2fsprogs-libblkid`


----------



## balanga (Aug 7, 2014)

Thanks for the help, I now have blkid installed, but unfortunately it doesn't show any devices. What command in FreeBSD will show all attached devices?


----------



## DutchDaemon (Aug 7, 2014)

devinfo(8), pciconf(8), usbconfig(8), pnpinfo(8) (ok, that's pushing it..)


----------



## usdmatt (Aug 7, 2014)

We may be able to provide more help, or possible alternative commands if we knew what you were actually trying to do.


----------



## balanga (Aug 7, 2014)

According to the man page for blkid:



> The blkid program is the command-line interface to working with the
> libblkid(3) library.  It can determine the type of content (e.g.
> filesystem or swap) that a block device holds, and also the
> attributes (tokens, NAME=value pairs) from the content metadata (e.g.
> LABEL or UUID fields).


This is the information I am trying to get.  I can't get the version I have installed on FreeBSD to work properly. Try blkid on a Linux system to see what info it returns.


----------



## junovitch@ (Aug 8, 2014)

See if `gpart list` is what you are looking for as it also shows the label, UUID, and file system type.  If you need different forms of parsable output, try out each of the following and see what works:
`sysctl kern.geom.confxml`
`sysctl kern.geom.confdot`
`sysctl kern.geom.conftxt`


----------



## balanga (Aug 8, 2014)

I guess `gpart list` is a huge superset of blkid's capabilities as I've just discovered.

The trouble (for me) is understanding exactly what it shows. I'll just have to persevere with some of the options.


----------



## balanga (Aug 8, 2014)

I have just noticed that the list option for gpart is not described in the FreeBSD man pages.

Can someone confirm this?


----------



## SirDice (Aug 8, 2014)

balanga said:
			
		

> I have just noticed that the list option for gpart is not described in the FreeBSD man pages.
> 
> Can someone confirm this?


Indeed. It seems to be missing. At least on my 10.0-STABLE (r267684).


----------



## kpa (Aug 8, 2014)

It's mentioned in the geom(8) manual page, every GEOM class and the matching command line utility is supposed to have a list subcommand. It should be mentioned in the gpart(8) manual page too though.


----------



## vince66 (Mar 3, 2018)

Hello guys,

in this post junovitch@ wrote that the command `gpart list` can be used to retrieve the same information given by the Linux "blkid" command.

In particular he suggests different and usefull forms of output like:
`sysctl kern.geom.conftxt`

Effectively it is true.

Because I'm only interested in some of the fields shown by the `sysctl kern.geom.conftxt` can you help me to understand how can I extract them from the output of this command, that is show them on the monitor or again store them in a text file ?

Thanks in advance.


----------



## Beastie (Mar 4, 2018)

vince66 said:


> Because I'm only interested in some of the fields shown by the "sysctl kern.geom.conftxt", can you help me to understand how can I extract them from the output of this command, that is show them on the monitor or again store them in a text file ?


grep(1), awk(1), sed(1), any combination of these, etc. There are plenty of examples in the EXAMPLE sections of these manual pages and online.
Your question is really vague.


----------

