All of lore.kernel.org
 help / color / mirror / Atom feed
* how to identify filesystem type
@ 2004-08-19  3:22 Pankaj Agarwal
  2004-08-19  8:13 ` ippi
  0 siblings, 1 reply; 13+ messages in thread
From: Pankaj Agarwal @ 2004-08-19  3:22 UTC (permalink / raw)
  To: linux-newbie

Hi,

I need your help, in understanding filesystems. Kindly let me know how to
identify the filesystem in an image file or block device.

thanks in advance and regards,

Pankaj Agarwal

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  3:22 how to identify filesystem type Pankaj Agarwal
@ 2004-08-19  8:13 ` ippi
  2004-08-19  9:06   ` ippi
  2004-08-19  9:07   ` Pankaj Agarwal
  0 siblings, 2 replies; 13+ messages in thread
From: ippi @ 2004-08-19  8:13 UTC (permalink / raw)
  To: Pankaj Agarwal, linux-newbie


--- Pankaj Agarwal <pankaj@pnpexports.com> wrote:

> Kindly let me know how to
> identify the filesystem in an image file or block
> device.
> 

Hi Pankaj,

if you've got an image file called somefs.img you
should be able to do:

    file somefs.img

If you've got a block device - say /dev/hda1 - then
you'll need to do the following (probably as root).
Be careful to type this command correctly or you
could be in a world of pain

    dd if=/dev/hda1 bs=1k count=5 | file -

A
DO NOT USE dd WITH ANYTHING UNDER /dev WHILE RUNNING 
AS ROOT UNLESS YOU REALLY, REALLY HAVE TO.


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  8:13 ` ippi
@ 2004-08-19  9:06   ` ippi
  2004-08-19  9:07   ` Pankaj Agarwal
  1 sibling, 0 replies; 13+ messages in thread
From: ippi @ 2004-08-19  9:06 UTC (permalink / raw)
  To: linux-newbie


Sorry for the typo, the command to check a block 
device such as /dev/hda1 is:

    dd if=/dev/hda1 bs=1k count=5 | file -

Regards,

ippi


		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  8:13 ` ippi
  2004-08-19  9:06   ` ippi
@ 2004-08-19  9:07   ` Pankaj Agarwal
  2004-08-19  9:48     ` ippi
  1 sibling, 1 reply; 13+ messages in thread
From: Pankaj Agarwal @ 2004-08-19  9:07 UTC (permalink / raw)
  To: ippi, linux-newbie

hi,

it doesn't provide the information seeked....i am enclosing the output
below...
# file /mnt/hda5/hdstg2.img

/mnt/hda5/hdstg2.img: data

# dd if=/dev/hdc1 bs=1k count=5 | file -

standard input: data

5+0 records in

4+0 records out

# file -s /dev/hdc{,1,2,3,4,5,6,7,8,9,10}

/dev/hdc: x86 boot sector

/dev/hdc1: data

/dev/hdc2: x86 boot sector, extended partition table

/dev/hdc3: empty

/dev/hdc4: empty

/dev/hdc5: data

/dev/hdc6: data

/dev/hdc7: data

/dev/hdc8: Linux/i386 swap file version 1 (4K pages) size 63999 pages

/dev/hdc9: data

/dev/hdc10: empty

kindly suggest more about it...

thanks, Pankaj



----- Original Message -----
From: "ippi" <heynumbertwo@yahoo.com>
To: "Pankaj Agarwal" <pankaj@pnpexports.com>; <linux-newbie@vger.kernel.org>
Sent: Thursday, August 19, 2004 1:43 PM
Subject: Re: how to identify filesystem type


>
> --- Pankaj Agarwal <pankaj@pnpexports.com> wrote:
>
> > Kindly let me know how to
> > identify the filesystem in an image file or block
> > device.
> >
>
> Hi Pankaj,
>
> if you've got an image file called somefs.img you
> should be able to do:
>
>     file somefs.img
>
> If you've got a block device - say /dev/hda1 - then
> you'll need to do the following (probably as root).
> Be careful to type this command correctly or you
> could be in a world of pain
>
>     dd if=/dev/hda1 bs=1k count=5 | file -
>
> A
> DO NOT USE dd WITH ANYTHING UNDER /dev WHILE RUNNING
> AS ROOT UNLESS YOU REALLY, REALLY HAVE TO.
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* how to identify filesystem type
@ 2004-08-19  9:07 Pankaj Agarwal
  2004-08-19  9:46 ` Andreas Schwab
  0 siblings, 1 reply; 13+ messages in thread
From: Pankaj Agarwal @ 2004-08-19  9:07 UTC (permalink / raw)
  To: linux-kernel

Hi,

I need your help, in understanding filesystems. Kindly let me know how to
identify the filesystem in an image file or block device.

thanks in advance and regards,

Pankaj Agarwal


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  9:07 Pankaj Agarwal
@ 2004-08-19  9:46 ` Andreas Schwab
  2004-08-19 14:03   ` Pankaj Agarwal
  0 siblings, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2004-08-19  9:46 UTC (permalink / raw)
  To: Pankaj Agarwal; +Cc: linux-kernel

"Pankaj Agarwal" <pankaj@pnpexports.com> writes:

> I need your help, in understanding filesystems. Kindly let me know how to
> identify the filesystem in an image file or block device.

Use file:

# file -s /dev/hda3
/dev/hda3: ReiserFS V3.6 block size 4096 (mounted or unclean) num blocks 9500285 r5 hash

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  9:07   ` Pankaj Agarwal
@ 2004-08-19  9:48     ` ippi
  0 siblings, 0 replies; 13+ messages in thread
From: ippi @ 2004-08-19  9:48 UTC (permalink / raw)
  To: Pankaj Agarwal, linux-newbie



I see what you mean. I created a reiserfs filesystem
and file only recognised it as data. If the block
devices are all hard disk partitions you should 
try fdisk:

    fdisk -l

Also, if you're interested in the filesystems of 
block devices that are already mounted, then just
type:

    mount

I don't know what is on the image /mnt/hda5/hdstg2.img
but you could try to mount it and see if it's 
recognised. Just do the following:

    mkdir mp
    mount -v -o loop /mnt/hda5/hdstg2.img mp

I take it you are sure that there are filesystems on
these devices and that they are not corrupted!


--- Pankaj Agarwal <pankaj@pnpexports.com> wrote:
> hi,
> 
> it doesn't provide the information seeked....i am
> enclosing the output
> below...
> # file /mnt/hda5/hdstg2.img
> 
> /mnt/hda5/hdstg2.img: data
> 
> # dd if=/dev/hdc1 bs=1k count=5 | file -
> 
> standard input: data
> 
> 5+0 records in
> 
> 4+0 records out
> 
> # file -s /dev/hdc{,1,2,3,4,5,6,7,8,9,10}
> 
> /dev/hdc: x86 boot sector
> 
> /dev/hdc1: data
> 
> /dev/hdc2: x86 boot sector, extended partition table
> 
> /dev/hdc3: empty
> 
> /dev/hdc4: empty
> 
> /dev/hdc5: data
> 
> /dev/hdc6: data
> 
> /dev/hdc7: data
> 
> /dev/hdc8: Linux/i386 swap file version 1 (4K pages)
> size 63999 pages
> 
> /dev/hdc9: data
> 
> /dev/hdc10: empty
> 
> kindly suggest more about it...
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19  9:46 ` Andreas Schwab
@ 2004-08-19 14:03   ` Pankaj Agarwal
  2004-08-20 15:36     ` Frank Steiner
  2004-08-20 20:46     ` Andreas Dilger
  0 siblings, 2 replies; 13+ messages in thread
From: Pankaj Agarwal @ 2004-08-19 14:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linux-kernel

Hi Andreas,

this is the output when you have a mounted block device.....you can only
mount when you know the filesystem ....thats wat i wanna know...hoe to
identify filesytems...on ablockdevice.

thanks anyways, looking forward for more information on this

Pankaj


----- Original Message -----
From: "Andreas Schwab" <schwab@suse.de>
To: "Pankaj Agarwal" <pankaj@pnpexports.com>
Cc: <linux-kernel@vger.kernel.org>
Sent: Thursday, August 19, 2004 3:16 PM
Subject: Re: how to identify filesystem type


"Pankaj Agarwal" <pankaj@pnpexports.com> writes:

> I need your help, in understanding filesystems. Kindly let me know how to
> identify the filesystem in an image file or block device.

Use file:

# file -s /dev/hda3
/dev/hda3: ReiserFS V3.6 block size 4096 (mounted or unclean) num blocks
9500285 r5 hash

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19 14:03   ` Pankaj Agarwal
@ 2004-08-20 15:36     ` Frank Steiner
  2004-08-20 20:46     ` Andreas Dilger
  1 sibling, 0 replies; 13+ messages in thread
From: Frank Steiner @ 2004-08-20 15:36 UTC (permalink / raw)
  To: Pankaj Agarwal; +Cc: Andreas Schwab, linux-kernel

Pankaj Agarwal wrote:
> Hi Andreas,
> 
> this is the output when you have a mounted block device.....you can only
> mount when you know the filesystem ....thats wat i wanna know...hoe to
> identify filesytems...on ablockdevice.

And when it's not mounted, the output is still enough:

zassenhaus /root# grep /dev/hda7 /proc/mounts
zassenhaus /root# file -s /dev/hda7
/dev/hda7: ReiserFS V3.6 block size 4096 num blocks 11378028 r5 hash

galois fst/tmp# grep /dev/hda8 /proc/mounts
galois fst/tmp# file -s /dev/hda8
/dev/hda8: Linux rev 1.0 ext3 filesystem data

That's all you need to know...

-- 
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-19 14:03   ` Pankaj Agarwal
  2004-08-20 15:36     ` Frank Steiner
@ 2004-08-20 20:46     ` Andreas Dilger
  2004-08-20 21:58       ` Andries Brouwer
  1 sibling, 1 reply; 13+ messages in thread
From: Andreas Dilger @ 2004-08-20 20:46 UTC (permalink / raw)
  To: Pankaj Agarwal; +Cc: Andreas Schwab, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

On Aug 19, 2004  19:33 +0530, Pankaj Agarwal wrote:
> 
> this is the output when you have a mounted block device.....you can only
> mount when you know the filesystem ....thats wat i wanna know...hoe to
> identify filesytems...on ablockdevice.
> 
> thanks anyways, looking forward for more information on this

There is a tool available as part of e2fsprogs (1.34 maybe?) which is
called "blkid" that identifies block devices.  Currently fsck uses this
to know what fsck.fstype to use, and it was my hope to have mount(8)
use this also (never got around to doing that work).

The benefits of blkid are that you can use it as a regular user, even
without read access to the disk (it will return cached values generated
by root if you don't have read access to the block device), it also will
print LABEL and UUID information to identify the filesystem, if you use
it repeatedly from some application it doesn't re-scan all of the devices
each time (important for large numbers of block devices).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/             http://members.shaw.ca/golinux/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-20 20:46     ` Andreas Dilger
@ 2004-08-20 21:58       ` Andries Brouwer
  2004-08-21  3:25         ` Theodore Ts'o
  0 siblings, 1 reply; 13+ messages in thread
From: Andries Brouwer @ 2004-08-20 21:58 UTC (permalink / raw)
  To: Pankaj Agarwal, Andreas Schwab, linux-kernel

On Fri, Aug 20, 2004 at 02:46:56PM -0600, Andreas Dilger wrote:

> There is a tool available as part of e2fsprogs (1.34 maybe?) which is
> called "blkid" that identifies block devices.  Currently fsck uses this
> to know what fsck.fstype to use, and it was my hope to have mount(8)
> use this also (never got around to doing that work).
> 
> The benefits of blkid are that you can use it as a regular user, even
> without read access to the disk (it will return cached values generated
> by root if you don't have read access to the block device), it also will
> print LABEL and UUID information to identify the filesystem, if you use
> it repeatedly from some application it doesn't re-scan all of the devices
> each time (important for large numbers of block devices).

I suppose this code started as part of mount(8). For example,

# mount --guess-fstype /dev/hdb2
reiserfs

However, I cannot stress often enough that these are unreliable guesses.
It is really undesirable when standard infrastructure starts depending
on 99.7% guesses.

Consequently, "blkid" is a really bad name. It gives no indication
of the guessed nature of its results.

(I see that my current version is also broken:
# blkid -v
blkid 1.0.0 (12-Feb-2003)
# blkid
...
/dev/sda4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
/dev/sda1: UUID="1ac5969c-8fdf-4f69-934a-c6103d93c05d" TYPE="ext2" 
/dev/sdb4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
/dev/sdb1: LABEL="CF_CARD032M" UUID="2001-1207" TYPE="msdos" 
...
Here no /dev/sda1 and no /dev/sdb4 exist.)

Andries


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-20 21:58       ` Andries Brouwer
@ 2004-08-21  3:25         ` Theodore Ts'o
  2004-08-21  8:51           ` Andries Brouwer
  0 siblings, 1 reply; 13+ messages in thread
From: Theodore Ts'o @ 2004-08-21  3:25 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: Pankaj Agarwal, Andreas Schwab, linux-kernel

On Fri, Aug 20, 2004 at 11:58:58PM +0200, Andries Brouwer wrote:
> 
> I suppose this code started as part of mount(8). For example,
> 
> # mount --guess-fstype /dev/hdb2
> reiserfs

Actually, it was fsck's filesystem type detection code, and it's since
been completely rewritten.  

> However, I cannot stress often enough that these are unreliable guesses.
> It is really undesirable when standard infrastructure starts depending
> on 99.7% guesses.

It's certainly possible for mistakes to be made, but it is really
quite reliable at this point --- escpecially since various
filesystem's mkfs programs and various lvm partition initialization
progams are pretty good about erasing other filesystems' signatures as
part of the mkfs/partition init process.  

Everything is really a "guess" at some level; there is no guarantee
that /etc/fstab is 100% accurate, or that the partition table's type
fields are accurate.  I will say that the ID code in the blkid library
is pretty paranoid about sanity checks, although of course it could be
better.

> Consequently, "blkid" is a really bad name. It gives no indication
> of the guessed nature of its results.
> 
> (I see that my current version is also broken:
> # blkid -v
> blkid 1.0.0 (12-Feb-2003)
> # blkid
> ...
> /dev/sda4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
> /dev/sda1: UUID="1ac5969c-8fdf-4f69-934a-c6103d93c05d" TYPE="ext2" 
> /dev/sdb4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
> /dev/sdb1: LABEL="CF_CARD032M" UUID="2001-1207" TYPE="msdos" 
> ...
> Here no /dev/sda1 and no /dev/sdb4 exist.)

Blkid deliberately doesn't revalidate devices without any command-line
arguments, because certain devices might timeout or block for a
long-time.  If you use "blkid /dev/sdb4", or use the library
interfaces, it will revalidate any entries found in the cache file
before returning them.

						- Ted

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to identify filesystem type
  2004-08-21  3:25         ` Theodore Ts'o
@ 2004-08-21  8:51           ` Andries Brouwer
  0 siblings, 0 replies; 13+ messages in thread
From: Andries Brouwer @ 2004-08-21  8:51 UTC (permalink / raw)
  To: Theodore Ts'o, Andries Brouwer, Pankaj Agarwal,
	Andreas Schwab, linux-kernel

On Fri, Aug 20, 2004 at 11:25:21PM -0400, Theodore Ts'o wrote:

> > Consequently, "blkid" is a really bad name. It gives no indication
> > of the guessed nature of its results.
> > 
> > (I see that my current version is also broken:
> > # blkid -v
> > blkid 1.0.0 (12-Feb-2003)
> > # blkid
> > ...
> > /dev/sda4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
> > /dev/sda1: UUID="1ac5969c-8fdf-4f69-934a-c6103d93c05d" TYPE="ext2" 
> > /dev/sdb4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
> > /dev/sdb1: LABEL="CF_CARD032M" UUID="2001-1207" TYPE="msdos" 
> > ...
> > Here no /dev/sda1 and no /dev/sdb4 exist.)
> 
> Blkid deliberately doesn't revalidate devices without any command-line
> arguments, because certain devices might timeout or block for a
> long-time.  If you use "blkid /dev/sdb4", or use the library
> interfaces, it will revalidate any entries found in the cache file
> before returning them.

Yes:

# blkid
...
/dev/sda4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos"
/dev/sda1: UUID="1ac5969c-8fdf-4f69-934a-c6103d93c05d" TYPE="ext2" 
/dev/sdb4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos" 
...
# blkid /dev/sda1
# blkid /dev/sdb4
# blkid
...
/dev/sda4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos"
/dev/sda1: UUID="1ac5969c-8fdf-4f69-934a-c6103d93c05d" TYPE="ext2"
/dev/sdb4: LABEL="ZIP-100" UUID="34D8-1C07" TYPE="msdos"
...
#

So, the cache file is not updated.
Moreover, the cache file has never been correct - there is only
one ZIP drive here and it is /dev/sda. The disk inside has only
one nonempty partition, and it is /dev/sda4.
The command # blkid -c /dev/null does not list these two bogus
entries, and a new /etc/blkid.tab is written, but a subsequent
command # blkid again lists the bogus entries.
Doing # rm /etc/blkid.tab* by hand helps.

Andries

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-08-21  8:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-19  3:22 how to identify filesystem type Pankaj Agarwal
2004-08-19  8:13 ` ippi
2004-08-19  9:06   ` ippi
2004-08-19  9:07   ` Pankaj Agarwal
2004-08-19  9:48     ` ippi
  -- strict thread matches above, loose matches on Subject: below --
2004-08-19  9:07 Pankaj Agarwal
2004-08-19  9:46 ` Andreas Schwab
2004-08-19 14:03   ` Pankaj Agarwal
2004-08-20 15:36     ` Frank Steiner
2004-08-20 20:46     ` Andreas Dilger
2004-08-20 21:58       ` Andries Brouwer
2004-08-21  3:25         ` Theodore Ts'o
2004-08-21  8:51           ` Andries Brouwer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.