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

Kevin Otte nivex at nivex.net
Fri Oct 25 10:18:49 EDT 2013


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


On 10/24/2013 01:49 PM, Michael Coburn wrote:
> Hi,
> 
> I have some hard drives laying around, that were once part of a mdadm RAID5
> array.  I put them back together using --assemble, but I can't remember
> what filesystem I had formatted them with.  Does anyone know how I can
> sample the block device and know conclusively what filesystem is on there?
> 
> It won't mount:
> 
> root at raspbx:~# mount /dev/md0 /media/data/
> mount: wrong fs type, bad option, bad superblock on /dev/md0,
>        missing codepage or helper program, or other error
>        In some cases useful info is found in syslog - try
>        dmesg | tail  or so
> 
> root at raspbx:~# fdisk -l /dev/md0
> 
> Disk /dev/md0: 1000.2 GB, 1000215543808 bytes
> 2 heads, 4 sectors/track, 244193248 cylinders, total 1953545984 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 65536 bytes / 131072 bytes
> Disk identifier: 0x00000000
> 
> Disk /dev/md0 doesn't contain a valid partition table
> 
> root at raspbx:~# mdadm --detail /dev/md0
> /dev/md0:
>         Version : 0.90
>   Creation Time : Sat Oct 11 19:39:57 2008
>      Raid Level : raid5
>      Array Size : 976772992 (931.52 GiB 1000.22 GB)
>   Used Dev Size : 488386496 (465.76 GiB 500.11 GB)
>    Raid Devices : 3
>   Total Devices : 2
> Preferred Minor : 0
>     Persistence : Superblock is persistent
> 
>     Update Time : Thu Oct 24 13:42:14 2013
>           State : clean, degraded
>  Active Devices : 2
> Working Devices : 2
>  Failed Devices : 0
>   Spare Devices : 0
> 
>          Layout : left-symmetric
>      Chunk Size : 64K
> 
>            UUID : ec499738:2185dff1:766caf6a:1af60f76
>          Events : 0.115446
> 
>     Number   Major   Minor   RaidDevice State
>        0       0        0        0      removed
>        1       8       16        1      active sync   /dev/sdb
>        2       8        0        2      active sync   /dev/sda
> 
> I have them connected to a raspberry pi running raspbx - Asterisk (Debian
> based)
> root at raspbx:~# cat /etc/*release
> PRETTY_NAME="Debian GNU/Linux wheezy/sid"
> NAME="Debian GNU/Linux"
> ID=debian
> ANSI_COLOR="1;31
> 
> dmesg:
> [7611406.513739] scsi 18:0:0:0: Direct-Access     ST350032 0AS
>       PQ: 0 ANSI: 4
> [7611406.532182] sd 18:0:0:0: [sdb] 976773168 512-byte logical blocks: (500
> GB/465 GiB)
> [7611406.569174] sd 18:0:0:0: [sdb] Write Protect is off
> [7611406.583465] sd 18:0:0:0: [sdb] Mode Sense: 38 00 00 00
> [7611406.590171] sd 18:0:0:0: [sdb] No Caching mode page present
> [7611406.599980] sd 18:0:0:0: [sdb] Assuming drive cache: write through
> [7611406.627998] sd 18:0:0:0: [sdb] No Caching mode page present
> [7611406.637617] sd 18:0:0:0: [sdb] Assuming drive cache: write through
> [7611406.675618]  sdb: unknown partition table
> [7611406.704149] sd 18:0:0:0: [sdb] No Caching mode page present
> [7611406.713733] sd 18:0:0:0: [sdb] Assuming drive cache: write through
> [7611406.723827] sd 18:0:0:0: [sdb] Attached SCSI disk
> [7611440.826363] md: md0 stopped.
> [7611440.865723] md: bind<sda>
> [7611440.881015] md: bind<sdb>
> [7611440.915728] bio: create slab <bio-1> at 1
> [7611440.925684] md/raid:md0: device sdb operational as raid disk 1
> [7611440.936370] md/raid:md0: device sda operational as raid disk 2
> [7611440.952322] md/raid:md0: allocated 3176kB
> [7611440.970557] md/raid:md0: raid level 5 active with 2 out of 3 devices,
> algorithm 2
> [7611440.995994] RAID conf printout:
> [7611440.996026]  --- level:5 rd:3 wd:2
> [7611440.996043]  disk 1, o:1, dev:sdb
> [7611440.996055]  disk 2, o:1, dev:sda
> [7611440.996300] md0: detected capacity change from 0 to 1000215543808
> [7611441.082733]  md0: unknown partition table
> --
> michael
> 



More information about the TriLUG mailing list