<br><div class="gmail_quote">On Thu, Jun 25, 2009 at 9:49 PM, Andreas Dilger <span dir="ltr"><<a href="mailto:adilger@sun.com">adilger@sun.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Jun 25, 2009  18:58 -0700, Smit Shah wrote:<br>
> I just ran through this post, and since no solution was posted, here's<br>
> a piece of code that i had written<br>
> Infact when i wrote this i wanted both the device name and also the<br>
> file system on that partition.<br>
<br>
</div>What is wrong with just using the "blkid" program? </blockquote><div> I guess blkid uses the same interfaces but the command doesn't provide option to specify the device number. But when i wrote this what i wanted to do is to get the file system of the device on which  the file resides.  </div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> It doesn't need<br>
root permission (if it is using the cache):<br>
</blockquote><div>Yes.  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
[adilger ~]$ blkid<br>
/dev/sda1: LABEL="boot" UUID="1fe1d719-1a8c-45a0-969a-cba8b101cc57" TYPE="ext3" SEC_TYPE="ext2"<br>
/dev/sda2: LABEL="FC8" UUID="3bf693a3-a288-45ea-9f8b-1d140254b44c" TYPE="ext3" SEC_TYPE="ext2"<br>
/dev/sda3: TYPE="swap" LABEL="swap" UUID="d37ac19b-c8e1-42d5-8802-f1c98a6d7062"<br>
/dev/sda5: UUID="zm1xpW-mGQT-wlXO-dgMR-Gtx0-F5iI-9SSlxK" TYPE="lvm2pv"<br>
/dev/dm-0: LABEL="home" UUID="1bcd7718-3d7b-41ba-ab1a-f38e0fe40cf9" TYPE="ext3" SEC_TYPE="ext2"<br>
<br>
and you can get the filesystem type of all or a specific device easily:<br>
<br>
[adilger ~]$ blkid -s TYPE<br>
/dev/sda1: TYPE="ext3"<br>
/dev/sda2: TYPE="ext3"<br>
/dev/sda3: TYPE="swap"<br>
/dev/sda5: TYPE="lvm2pv"<br>
/dev/dm-0: TYPE="ext3"<br>
<br>
[adilger ~]$ blkid -s TYPE /dev/sda2<br>
/dev/sda2: TYPE="ext3"<br>
<br>
or other information such as the filesystem label:<br>
<br>
[adilger ~]$ blkid -s LABEL /dev/sda2<br>
/dev/sda1: LABEL="boot"<br>
<br>
<br>
Cheers, Andreas<br>
<font color="#888888">--<br>
Andreas Dilger<br>
Sr. Staff Engineer, Lustre Group<br>
Sun Microsystems of Canada, Inc.<br>
<br>
</font></blockquote></div><br>