LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-05-2009, 02:17 AM   #1
zhaohuiyu2
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Rep: Reputation: 0
How to get the filesystem type of a disk partition?


hi, Friends.
I am learning linux, I want to know through which command I can get the file system type of a special disk partition. such as /dev/sda1.
Any help is appreciated.
 
Old 05-05-2009, 02:26 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You can use the option -T of the df command. If you want to put the filesystem type in a variable (if you're writing a script) you have to extract this information from the output:
Code:
fstype=$(df -T /dev/sda1 | tail -1 | awk '{print $2}')
 
Old 05-05-2009, 02:41 AM   #3
zhaohuiyu2
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Great! I get it. Thanks for your help
 
Old 05-05-2009, 03:35 AM   #4
wjp.reg
LQ Newbie
 
Registered: Oct 2005
Distribution: Linux Mint 6; Ubuntu 8.04
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by zhaohuiyu2 View Post
hi, Friends.
I am learning linux, I want to know through which command I can get the file system type of a special disk partition. such as /dev/sda1.
Any help is appreciated.
This works nicely too..

Code:
 sudo fdisk -l /dev/sd?
, where '?' specifies the drive a-z.

cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual Boot Vista Suse 10.2 error setting type of partition to type 82 jmp559 Linux - General 1 05-15-2008 06:40 PM
GRUB won't load windows partition - root (hd0,0), Filesystem type unknown partition.. cillm527 Linux - Software 4 04-27-2008 06:44 AM
Discover what filesystem(s) are on a disk/partition? humbletech99 Linux - General 4 02-02-2008 01:32 PM
filesystem type unknown, partition type 0x7 crazyface_juicebox Linux - General 1 02-11-2007 11:50 PM
root (hd 0,0)Filesystem type unknown, partition type 0x7chainloader +1 ece30675 Linux - Distributions 5 07-20-2004 09:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration