[TriLUG] How to identify a block device's filesystem type?

Michael Coburn michael at gravis.ca
Fri Oct 25 10:32:48 EDT 2013


On Fri, Oct 25, 2013 at 10:18 AM, Kevin Otte <nivex at nivex.net> wrote:
> file -s /dev/mdX
>
> -s, --special-files
>   Normally, file only attempts to read and determine the type of
> argument files which stat(2) reports are ordinary files.  This prevents
> problems, because reading special files may have peculiar consequences.
>  Specifying the -s option causes file to also read argument files which
> are block or character special files.  This is useful for determining
> the filesystem types of the data in raw disk partitions, which are block
> special files.  This option also causes file to disregard the file size
> as reported by stat(2) since on some systems it reports a zero size for
> raw disk partitions.
>
> by example:
> root at atlantis:~# file -s /dev/md3
> /dev/md3: LVM2 PV (Linux Logical Volume Manager), UUID:
> p8WsGP-0pgK-tnca-ea08-qrtQ-Qik3-V67wjn, size: 749890437120

Kevin, that's great stuff, thank you :)

root at raspbx:~# file --special-files /dev/md0
/dev/md0: sticky JFS2 filesystem image (label " "), 1953420424 blocks,
blocksize 4096


More information about the TriLUG mailing list