how to know the file system type [programming]

dpk dpk at
Wed Aug 17 20:28:43 GMT 2005

On Wed, 17 Aug 2005, Jorge Mario G. Mazo wrote:

> hi there
> I've been looking for a way to check the fs type
> I need to do something like this
> if NTFS do this
> if msdis do that
> if ufs2  do that
> if ext2 do this other stuff
> thanks in advance

I'd check out the fdisk code. For example:

$ fdisk /dev/ad0 | grep sysid
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)

Figure out how it determines the sysid, and then you can use that in your
code. You'd still need a function to determine what disks are physically

More information about the freebsd-questions mailing list