* how to identify filesystem type @ 2004-08-19 9:07 Pankaj Agarwal 2004-08-19 9:46 ` Andreas Schwab 0 siblings, 1 reply; 8+ 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] 8+ messages in thread
* Re: how to identify filesystem type 2004-08-19 9:07 how to identify filesystem type Pankaj Agarwal @ 2004-08-19 9:46 ` Andreas Schwab 2004-08-19 14:03 ` Pankaj Agarwal 0 siblings, 1 reply; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread
end of thread, other threads:[~2004-08-21 8:52 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-08-19 9:07 how to identify filesystem type 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 a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox