LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I find filesystem type (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-find-filesystem-type-28351/)

sykkn 08-20-2002 11:01 AM

How do I find filesystem type
 
Does anyone know of a command that would return the fs type if given the device name.
Example:
===============
# whatfs /dev/hda1
ext3
===============

I know that I can do 'fdisk -l /dev/hda' and I can then look for /dev/hda1, but that complicates
what I am doing. I would appreciate any help.

notsoevil 08-20-2002 03:03 PM

# cat /proc/mounts | grep /dev/hda1

Malicious 08-20-2002 03:11 PM

Try: fsck -N /dev/hda1

Executes and shows the internal command
used to fire up the appropriate file system
checker. Should display something like:

fsck 1.27 (8-Mar-2002)
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 /dev/hda1

Shows the fsck version, checker executable, command
number, file system label and the command to start
the checker. I ran this on RedHat 7.3 with my hda1
labeled as /boot and mounted as /boot.

Oh... the file system is ext3. The file system
type for the device is the extension of fsck.xxxx.

DavidPhillips 08-21-2002 12:50 AM

and here the type would be ntfs



fsck -N /dev/hda1
fsck 1.24a (02-Sep-2001)
fsck: fsck.ntfs: not found

DavidPhillips 08-21-2002 01:10 AM

I see what your trying to do,
maybe an easier way


some variation of this may work

cat /proc/mounts | grep /dev/hda1 | cut -d "a" -f2- | cut -d "/" -f2- | cut -d " " -f2



this returned

ntfs


play around with it


All times are GMT -5. The time now is 09:38 PM.