Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a command that will show which file system (ext3, ext4, FAT32, ...) the various partitions and disks are using?

Similar to how sudo fdisk -l lists information about disks and partitions?

share|improve this question
    
What do you mean by "similar to" sudo fdisk -l? ,,, Even when the drive is not mounted, fisk gives you the file system type, and it is a command line tool.... I unmounted two of my drives (a USB, and an Internal) and this worked fine: sudo fdisk -l|grep "^/dev" –  Peter.O Jan 2 '11 at 4:59
    
@fred fdisk says things like "Linux" and "Linux swap", can't see that it tells me whether it's ext3 or ext4. –  j-g-faustus Jan 2 '11 at 5:02
    
Don't go by the name;; go by the filesystem Id ... if its 83, fdisk reports it as "Linux`, gpart as mentioned by Luke Maurer) reports it as ext2 ,, same thing.. The drives I tested are Ext4 (but were reported as 'ext2' and 'Linux' by the two apps), but it seems that this identity is a higher abstraction. Whether you really need to go further is up to you... but the Id certainly gives you a pretty closes idea. (if you need to know specifically, perhaps 'gpart` in full scan mode will do it... (I havent tried its full scan, but I suspect it won't say much more (??).. –  Peter.O Jan 2 '11 at 5:29
add comment

5 Answers

up vote 6 down vote accepted

mount:

me@hostname:/$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)

...

share|improve this answer
    
Except that the disks aren't mounted - I'm trying to figure out which FS to put in /etc/fstab for a USB external disk –  j-g-faustus Jan 2 '11 at 1:48
    
Can't you mount it in Nautilus and then check? –  frabjous Jan 2 '11 at 3:04
    
I don't have a desktop environment, running headless over ssh. –  j-g-faustus Jan 2 '11 at 4:16
1  
@frabjous Why use Nautilus? Could also just mount it on the command line and then check; this usually works even if you don't specify the filesystem. –  Luke Maurer Jan 2 '11 at 4:28
    
@Luke Thanks, I'll try that –  j-g-faustus Jan 2 '11 at 4:35
show 2 more comments

It's somewhat overkill, but there's always gpart. It's meant for when the partition table is broken, but it does tell you what type all the filesystems it can find are.

EDIT: This doesn't seem to work if something on the disk is mounted already, though (I just tried it on my running system).

Theoretically, if you just want it to print the partition table, you can use a command like this (from the man page):

$ sudo gpart -vvd /dev/sda

But again I can't try it right now; not sure if it'll tell you the filesystems if it's not doing a scan.

share|improve this answer
    
Thanks, I'll try it out. –  j-g-faustus Jan 2 '11 at 4:34
    
I just tried it... I unmounted my "sdb" data drive via Nautilus.. It's mounpoint directory showed as "Total 0" via "ls -l" and anothe File Browser (PCMan) prompted me to mount it... but even though it wasn't mounted gpart did return basic partiton information; in particuar, it did show the filesystem –  Peter.O Jan 2 '11 at 5:03
    
It works, but a bit slower than the other answers - it takes a while to scan a 1TB disk. Still thanks for the pointer to a useful tool, I'm sure gpart will come in handy. –  j-g-faustus Jan 2 '11 at 5:22
add comment

Found a solution in ubuntuforums: blkid

System disk:

sudo blkid /dev/sda1
/dev/sda1: UUID="...." TYPE="ext4"

External USB disk:

sudo blkid /dev/sdf1
/dev/sdf1: LABEL="backup" UUID="..." TYPE="ext3"     

mdadm RAID:

sudo blkid /dev/md0
/dev/md0: LABEL="raid" UUID="..." TYPE="ext4" 

Mount without specifying filesystem (commenting out any entries in fstab) works as well:

sudo mount /dev/sdf1 /mnt/tmp
mount | grep /mnt/tmp
/dev/sdf1 on /mnt/tmp type ext3 (rw)
share|improve this answer
add comment

df -h -T will list all disks used with filesystem type.

share|improve this answer
add comment
lsblk -f

Will give you the filesystem of any attached devices, whether they are mounted or not.

It also gives you other useful information for creating the needed line for your fstab file such as the UUID.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.