How do I know if a partition is ext2, ext3, or ext4?












113














I just formatted stuff. One disk I format as ext2. The other I want to format as ext4. I want to test how they perform.



Now, how do I know the kind of file system in a partition?










share|improve this question


















  • 2




    Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
    – zacharyalexstern
    Jan 15 '13 at 15:36












  • unix.stackexchange.com/questions/34623/…
    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 12 '15 at 10:32
















113














I just formatted stuff. One disk I format as ext2. The other I want to format as ext4. I want to test how they perform.



Now, how do I know the kind of file system in a partition?










share|improve this question


















  • 2




    Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
    – zacharyalexstern
    Jan 15 '13 at 15:36












  • unix.stackexchange.com/questions/34623/…
    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 12 '15 at 10:32














113












113








113


31





I just formatted stuff. One disk I format as ext2. The other I want to format as ext4. I want to test how they perform.



Now, how do I know the kind of file system in a partition?










share|improve this question













I just formatted stuff. One disk I format as ext2. The other I want to format as ext4. I want to test how they perform.



Now, how do I know the kind of file system in a partition?







linux ext4 ext3 ext2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 9 '13 at 10:24









user4951

3,351215077




3,351215077








  • 2




    Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
    – zacharyalexstern
    Jan 15 '13 at 15:36












  • unix.stackexchange.com/questions/34623/…
    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 12 '15 at 10:32














  • 2




    Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
    – zacharyalexstern
    Jan 15 '13 at 15:36












  • unix.stackexchange.com/questions/34623/…
    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 12 '15 at 10:32








2




2




Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
– zacharyalexstern
Jan 15 '13 at 15:36






Out of curiosity, what are you trying to test? Journal vs. no journal? For the record, you can operate ext4 in no-journal mode, and still benefit from all the other new features.
– zacharyalexstern
Jan 15 '13 at 15:36














unix.stackexchange.com/questions/34623/…
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Sep 12 '15 at 10:32




unix.stackexchange.com/questions/34623/…
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Sep 12 '15 at 10:32










10 Answers
10






active

oldest

votes


















106














How do I tell what sort of data (what data format) is in a file?

→ Use the file utility.



Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see output like this:



# file -sL /dev/sd*
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=63fa0104-4aab-4dc8-a50d-e2c1bf0fb188 (extents) (large files) (huge files)
/dev/sdb1: Linux rev 1.0 ext2 filesystem data, UUID=b3c82023-78e1-4ad4-b6e0-62355b272166
/dev/sdb2: Linux/i386 swap file (new style), version 1 (4K pages), size 4194303 pages, no label, UUID=3f64308c-19db-4da5-a9a0-db4d7defb80f


Given this sample output, the first disk has one partition and the second disk has two partitions. /dev/sda1 is an ext4 filesystem, /dev/sdb1 is an ext2 filesystem, and /dev/sdb2 is some swap space (about 4GB).



You must run this command as root, because ordinary users may not read disk partitions directly: if needed, add sudo in front.






share|improve this answer



















  • 1




    When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
    – heinrich5991
    Jan 10 '13 at 16:55








  • 2




    @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
    – Gilles
    Jan 10 '13 at 16:57










  • Oh sorry, I overlooked that. :(
    – heinrich5991
    Jan 10 '13 at 20:35






  • 2




    doesn't work for LVM stuff: parted -l seems to work better
    – TiloBunt
    Nov 28 '14 at 21:35






  • 1




    @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
    – Gilles
    Dec 1 '14 at 17:04



















64














Another option is to use blkid:



$ blkid /dev/sda1
/dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"


This recognizes most filesystem types and stuff like encrypted partitions.



You can also search for partitions with a given type:



# blkid -t TYPE=ext2
/dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"
/dev/sdb1: UUID="b80153f4-92a1-473f-b7f6-80e601ae21ac" TYPE="ext2"





share|improve this answer

















  • 7




    +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
    – Warren Young
    Jan 9 '13 at 16:45










  • For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
    – Jose Diaz-Gonzalez
    Mar 4 '15 at 22:41












  • Thanks! The file command wasn't working, but this gave me what I needed.
    – Brain2000
    Apr 14 '16 at 4:51



















39














You can use sudo parted -l



[shredder12]$ sudo parted -l

Model: ATA WDC WD1600BEVT-7 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 8587MB 8587MB primary ext3 boot
4 8587MB 40.0GB 31.4GB primary ext4
2 40.0GB 55.0GB 15.0GB primary ext4
3 55.0GB 160GB 105GB extended
5 55.0GB 158GB 103GB logical ext4
6 158GB 160GB 1999MB logical linux-swap(v1)


Source






share|improve this answer

















  • 1




    parted is not installed. Also the drives are not mounted yet.
    – user4951
    Jan 9 '13 at 10:45






  • 1




    @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
    – Karthik T
    Jan 9 '13 at 12:24






  • 2




    +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
    – Warren Young
    Jan 9 '13 at 16:45










  • While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
    – user4951
    Jan 10 '13 at 2:34










  • Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
    – Basile Starynkevitch
    Jan 18 '16 at 8:18





















15














Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list:



# tune2fs -l /dev/sda1 | grep features


If in the list you see:





  • extent — it's ext4

  • no extent, but has_journal — it's ext3

  • neither extent nor has_journal — it's ext2


The parted and blkid answers are better if you want these heuristics run for you automatically. (They tell the difference with feature checks, too.) They can also identify non-ext? filesystems.



This method has the virtue of showing you the low-level differences.



The important thing to realize here is that these three filesystems are forwards compatible, and to some extent backwards-compatible, too. Later versions just add features on top of the older ones.



See the ext4 HOWTO for more information on this.






share|improve this answer































    9














    try using df -T see man df for more options still one more way I found is cfdisk






    share|improve this answer



















    • 2




      This has the same weakness as h3rmiller's mount based answer.
      – Warren Young
      Jan 9 '13 at 16:38






    • 3




      h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
      – Warren Young
      Jan 9 '13 at 18:19












    • @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
      – mattdm
      Jan 9 '13 at 19:05










    • @mattdm: So when you unmount it...is it still an ext4 filesystem?
      – Warren Young
      Jan 9 '13 at 19:26










    • @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
      – mattdm
      Jan 9 '13 at 19:32





















    8














    Surprised this isn't on here already.
    No sudo required:



    lsblk -f






    share|improve this answer





















    • If I run this without sudo the FSTYPE column is blank.
      – Flup
      Jul 15 '15 at 14:45










    • @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
      – Freedom_Ben
      Jul 18 '15 at 1:50












    • @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
      – don_crissti
      Sep 3 '15 at 22:00



















    3














    use -T option to print file system type



    [root@centos6 ~]# df -T

    Filesystem Type 1K-blocks Used Available Use% Mounted on
    /dev/mapper/VolGroup-lv_root
    ext4 6795192 6367072 76276 99% /
    tmpfs tmpfs 639164 0 639164 0% /dev/shm
    /dev/sda1 ext4 487652 28684 433368 7% /boot





    share|improve this answer





























      2














      fdisk -l
      will list



      Usage:



       fdisk [options] -l <disk> list partition table(s)
      fdisk -s <partition> give partition size(s) in blocks
      fdisk [options] <disk> change partition table





      share|improve this answer



















      • 2




        On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
        – Warren Young
        Jan 9 '13 at 20:17












      • +1 for effort. I have done fdisk before asking this question. Keep points up.
        – user4951
        Jan 10 '13 at 2:35



















      1














      Here's a useful oneliner to get just the filesystem type:



      blkid -o export <partition-device> | grep '^TYPE' | cut -d"=" -f2


      An example run is:



      # blkid -o export /dev/sda1 | grep '^TYPE' | cut -d"=" -f2
      vfat
      # blkid -o export /dev/sda2 | grep '^TYPE' | cut -d"=" -f2
      ext4





      share|improve this answer





























        0














        This didn't show the BSD answer I was looking for. I had the impression these type bytes were actually contained in the partition table on the disk, not sure about that. There's only type 85 for all Linux extfs types, but Linux doesn't recognize OpenBSD's A6 type at all either.




        > 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD
        > 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot
        > 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+
        > 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy*
        > 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap
        > 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris
        > 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS
        > 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12
        > 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M
        > 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled
        > 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C*
        > 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint
        > 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor
        > 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor
        > 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor
        > 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386
        > 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT
        > 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys
        > 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor
        > 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec
        > 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor
        > 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT
        > 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X


        The formatting may get mangled, it's a nice table 70 columns wide. If you're in OpenBSD's fdisk and you hit ? when it asks for partition type this is what you get. The types show when you're editing or listing the partition table.



        Partition types on Wikipedia: https://en.wikipedia.org/wiki/Partition_type






        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f60723%2fhow-do-i-know-if-a-partition-is-ext2-ext3-or-ext4%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          10 Answers
          10






          active

          oldest

          votes








          10 Answers
          10






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          106














          How do I tell what sort of data (what data format) is in a file?

          → Use the file utility.



          Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see output like this:



          # file -sL /dev/sd*
          /dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=63fa0104-4aab-4dc8-a50d-e2c1bf0fb188 (extents) (large files) (huge files)
          /dev/sdb1: Linux rev 1.0 ext2 filesystem data, UUID=b3c82023-78e1-4ad4-b6e0-62355b272166
          /dev/sdb2: Linux/i386 swap file (new style), version 1 (4K pages), size 4194303 pages, no label, UUID=3f64308c-19db-4da5-a9a0-db4d7defb80f


          Given this sample output, the first disk has one partition and the second disk has two partitions. /dev/sda1 is an ext4 filesystem, /dev/sdb1 is an ext2 filesystem, and /dev/sdb2 is some swap space (about 4GB).



          You must run this command as root, because ordinary users may not read disk partitions directly: if needed, add sudo in front.






          share|improve this answer



















          • 1




            When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
            – heinrich5991
            Jan 10 '13 at 16:55








          • 2




            @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
            – Gilles
            Jan 10 '13 at 16:57










          • Oh sorry, I overlooked that. :(
            – heinrich5991
            Jan 10 '13 at 20:35






          • 2




            doesn't work for LVM stuff: parted -l seems to work better
            – TiloBunt
            Nov 28 '14 at 21:35






          • 1




            @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
            – Gilles
            Dec 1 '14 at 17:04
















          106














          How do I tell what sort of data (what data format) is in a file?

          → Use the file utility.



          Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see output like this:



          # file -sL /dev/sd*
          /dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=63fa0104-4aab-4dc8-a50d-e2c1bf0fb188 (extents) (large files) (huge files)
          /dev/sdb1: Linux rev 1.0 ext2 filesystem data, UUID=b3c82023-78e1-4ad4-b6e0-62355b272166
          /dev/sdb2: Linux/i386 swap file (new style), version 1 (4K pages), size 4194303 pages, no label, UUID=3f64308c-19db-4da5-a9a0-db4d7defb80f


          Given this sample output, the first disk has one partition and the second disk has two partitions. /dev/sda1 is an ext4 filesystem, /dev/sdb1 is an ext2 filesystem, and /dev/sdb2 is some swap space (about 4GB).



          You must run this command as root, because ordinary users may not read disk partitions directly: if needed, add sudo in front.






          share|improve this answer



















          • 1




            When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
            – heinrich5991
            Jan 10 '13 at 16:55








          • 2




            @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
            – Gilles
            Jan 10 '13 at 16:57










          • Oh sorry, I overlooked that. :(
            – heinrich5991
            Jan 10 '13 at 20:35






          • 2




            doesn't work for LVM stuff: parted -l seems to work better
            – TiloBunt
            Nov 28 '14 at 21:35






          • 1




            @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
            – Gilles
            Dec 1 '14 at 17:04














          106












          106








          106






          How do I tell what sort of data (what data format) is in a file?

          → Use the file utility.



          Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see output like this:



          # file -sL /dev/sd*
          /dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=63fa0104-4aab-4dc8-a50d-e2c1bf0fb188 (extents) (large files) (huge files)
          /dev/sdb1: Linux rev 1.0 ext2 filesystem data, UUID=b3c82023-78e1-4ad4-b6e0-62355b272166
          /dev/sdb2: Linux/i386 swap file (new style), version 1 (4K pages), size 4194303 pages, no label, UUID=3f64308c-19db-4da5-a9a0-db4d7defb80f


          Given this sample output, the first disk has one partition and the second disk has two partitions. /dev/sda1 is an ext4 filesystem, /dev/sdb1 is an ext2 filesystem, and /dev/sdb2 is some swap space (about 4GB).



          You must run this command as root, because ordinary users may not read disk partitions directly: if needed, add sudo in front.






          share|improve this answer














          How do I tell what sort of data (what data format) is in a file?

          → Use the file utility.



          Here, you want to know the format of data in a device file, so you need to pass the -s flag to tell file not just to say that it's a device file but look at the content. Sometimes you'll need the -L flag as well, if the device file name is a symbolic link. You'll see output like this:



          # file -sL /dev/sd*
          /dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=63fa0104-4aab-4dc8-a50d-e2c1bf0fb188 (extents) (large files) (huge files)
          /dev/sdb1: Linux rev 1.0 ext2 filesystem data, UUID=b3c82023-78e1-4ad4-b6e0-62355b272166
          /dev/sdb2: Linux/i386 swap file (new style), version 1 (4K pages), size 4194303 pages, no label, UUID=3f64308c-19db-4da5-a9a0-db4d7defb80f


          Given this sample output, the first disk has one partition and the second disk has two partitions. /dev/sda1 is an ext4 filesystem, /dev/sdb1 is an ext2 filesystem, and /dev/sdb2 is some swap space (about 4GB).



          You must run this command as root, because ordinary users may not read disk partitions directly: if needed, add sudo in front.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 1 '14 at 17:04

























          answered Jan 9 '13 at 18:06









          Gilles

          529k12810581583




          529k12810581583








          • 1




            When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
            – heinrich5991
            Jan 10 '13 at 16:55








          • 2




            @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
            – Gilles
            Jan 10 '13 at 16:57










          • Oh sorry, I overlooked that. :(
            – heinrich5991
            Jan 10 '13 at 20:35






          • 2




            doesn't work for LVM stuff: parted -l seems to work better
            – TiloBunt
            Nov 28 '14 at 21:35






          • 1




            @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
            – Gilles
            Dec 1 '14 at 17:04














          • 1




            When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
            – heinrich5991
            Jan 10 '13 at 16:55








          • 2




            @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
            – Gilles
            Jan 10 '13 at 16:57










          • Oh sorry, I overlooked that. :(
            – heinrich5991
            Jan 10 '13 at 20:35






          • 2




            doesn't work for LVM stuff: parted -l seems to work better
            – TiloBunt
            Nov 28 '14 at 21:35






          • 1




            @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
            – Gilles
            Dec 1 '14 at 17:04








          1




          1




          When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
          – heinrich5991
          Jan 10 '13 at 16:55






          When entering $ sudo file /dev/sda1, I get /dev/sda1: block special
          – heinrich5991
          Jan 10 '13 at 16:55






          2




          2




          @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
          – Gilles
          Jan 10 '13 at 16:57




          @heinrich5991 “you need to pass the -s flag …”. I show the command file -s /dev/sd* − with sudo in front, that's sudo file -s /dev/sd*.
          – Gilles
          Jan 10 '13 at 16:57












          Oh sorry, I overlooked that. :(
          – heinrich5991
          Jan 10 '13 at 20:35




          Oh sorry, I overlooked that. :(
          – heinrich5991
          Jan 10 '13 at 20:35




          2




          2




          doesn't work for LVM stuff: parted -l seems to work better
          – TiloBunt
          Nov 28 '14 at 21:35




          doesn't work for LVM stuff: parted -l seems to work better
          – TiloBunt
          Nov 28 '14 at 21:35




          1




          1




          @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
          – Gilles
          Dec 1 '14 at 17:04




          @TiloBunt Make that file -sL /dev/mapper/foo-bar, with the -L flag to dereference the symlink.
          – Gilles
          Dec 1 '14 at 17:04













          64














          Another option is to use blkid:



          $ blkid /dev/sda1
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"


          This recognizes most filesystem types and stuff like encrypted partitions.



          You can also search for partitions with a given type:



          # blkid -t TYPE=ext2
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"
          /dev/sdb1: UUID="b80153f4-92a1-473f-b7f6-80e601ae21ac" TYPE="ext2"





          share|improve this answer

















          • 7




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
            – Jose Diaz-Gonzalez
            Mar 4 '15 at 22:41












          • Thanks! The file command wasn't working, but this gave me what I needed.
            – Brain2000
            Apr 14 '16 at 4:51
















          64














          Another option is to use blkid:



          $ blkid /dev/sda1
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"


          This recognizes most filesystem types and stuff like encrypted partitions.



          You can also search for partitions with a given type:



          # blkid -t TYPE=ext2
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"
          /dev/sdb1: UUID="b80153f4-92a1-473f-b7f6-80e601ae21ac" TYPE="ext2"





          share|improve this answer

















          • 7




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
            – Jose Diaz-Gonzalez
            Mar 4 '15 at 22:41












          • Thanks! The file command wasn't working, but this gave me what I needed.
            – Brain2000
            Apr 14 '16 at 4:51














          64












          64








          64






          Another option is to use blkid:



          $ blkid /dev/sda1
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"


          This recognizes most filesystem types and stuff like encrypted partitions.



          You can also search for partitions with a given type:



          # blkid -t TYPE=ext2
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"
          /dev/sdb1: UUID="b80153f4-92a1-473f-b7f6-80e601ae21ac" TYPE="ext2"





          share|improve this answer












          Another option is to use blkid:



          $ blkid /dev/sda1
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"


          This recognizes most filesystem types and stuff like encrypted partitions.



          You can also search for partitions with a given type:



          # blkid -t TYPE=ext2
          /dev/sda1: UUID="625fa1fa-2785-4abc-a15a-bfcc498139d1" TYPE="ext2"
          /dev/sdb1: UUID="b80153f4-92a1-473f-b7f6-80e601ae21ac" TYPE="ext2"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 9 '13 at 12:47









          crater2150

          2,56021521




          2,56021521








          • 7




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
            – Jose Diaz-Gonzalez
            Mar 4 '15 at 22:41












          • Thanks! The file command wasn't working, but this gave me what I needed.
            – Brain2000
            Apr 14 '16 at 4:51














          • 7




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
            – Jose Diaz-Gonzalez
            Mar 4 '15 at 22:41












          • Thanks! The file command wasn't working, but this gave me what I needed.
            – Brain2000
            Apr 14 '16 at 4:51








          7




          7




          +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
          – Warren Young
          Jan 9 '13 at 16:45




          +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. blkid isn't fooled by that.
          – Warren Young
          Jan 9 '13 at 16:45












          For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
          – Jose Diaz-Gonzalez
          Mar 4 '15 at 22:41






          For what its worth, this also appears to work for xfs drives, though apparently it's blkid is not as great as lsblk is at detecting unmounted drives (if you need to)
          – Jose Diaz-Gonzalez
          Mar 4 '15 at 22:41














          Thanks! The file command wasn't working, but this gave me what I needed.
          – Brain2000
          Apr 14 '16 at 4:51




          Thanks! The file command wasn't working, but this gave me what I needed.
          – Brain2000
          Apr 14 '16 at 4:51











          39














          You can use sudo parted -l



          [shredder12]$ sudo parted -l

          Model: ATA WDC WD1600BEVT-7 (scsi)
          Disk /dev/sda: 160GB
          Sector size (logical/physical): 512B/512B
          Partition Table: msdos

          Number Start End Size Type File system Flags
          1 32.3kB 8587MB 8587MB primary ext3 boot
          4 8587MB 40.0GB 31.4GB primary ext4
          2 40.0GB 55.0GB 15.0GB primary ext4
          3 55.0GB 160GB 105GB extended
          5 55.0GB 158GB 103GB logical ext4
          6 158GB 160GB 1999MB logical linux-swap(v1)


          Source






          share|improve this answer

















          • 1




            parted is not installed. Also the drives are not mounted yet.
            – user4951
            Jan 9 '13 at 10:45






          • 1




            @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
            – Karthik T
            Jan 9 '13 at 12:24






          • 2




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
            – user4951
            Jan 10 '13 at 2:34










          • Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
            – Basile Starynkevitch
            Jan 18 '16 at 8:18


















          39














          You can use sudo parted -l



          [shredder12]$ sudo parted -l

          Model: ATA WDC WD1600BEVT-7 (scsi)
          Disk /dev/sda: 160GB
          Sector size (logical/physical): 512B/512B
          Partition Table: msdos

          Number Start End Size Type File system Flags
          1 32.3kB 8587MB 8587MB primary ext3 boot
          4 8587MB 40.0GB 31.4GB primary ext4
          2 40.0GB 55.0GB 15.0GB primary ext4
          3 55.0GB 160GB 105GB extended
          5 55.0GB 158GB 103GB logical ext4
          6 158GB 160GB 1999MB logical linux-swap(v1)


          Source






          share|improve this answer

















          • 1




            parted is not installed. Also the drives are not mounted yet.
            – user4951
            Jan 9 '13 at 10:45






          • 1




            @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
            – Karthik T
            Jan 9 '13 at 12:24






          • 2




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
            – user4951
            Jan 10 '13 at 2:34










          • Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
            – Basile Starynkevitch
            Jan 18 '16 at 8:18
















          39












          39








          39






          You can use sudo parted -l



          [shredder12]$ sudo parted -l

          Model: ATA WDC WD1600BEVT-7 (scsi)
          Disk /dev/sda: 160GB
          Sector size (logical/physical): 512B/512B
          Partition Table: msdos

          Number Start End Size Type File system Flags
          1 32.3kB 8587MB 8587MB primary ext3 boot
          4 8587MB 40.0GB 31.4GB primary ext4
          2 40.0GB 55.0GB 15.0GB primary ext4
          3 55.0GB 160GB 105GB extended
          5 55.0GB 158GB 103GB logical ext4
          6 158GB 160GB 1999MB logical linux-swap(v1)


          Source






          share|improve this answer












          You can use sudo parted -l



          [shredder12]$ sudo parted -l

          Model: ATA WDC WD1600BEVT-7 (scsi)
          Disk /dev/sda: 160GB
          Sector size (logical/physical): 512B/512B
          Partition Table: msdos

          Number Start End Size Type File system Flags
          1 32.3kB 8587MB 8587MB primary ext3 boot
          4 8587MB 40.0GB 31.4GB primary ext4
          2 40.0GB 55.0GB 15.0GB primary ext4
          3 55.0GB 160GB 105GB extended
          5 55.0GB 158GB 103GB logical ext4
          6 158GB 160GB 1999MB logical linux-swap(v1)


          Source







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 9 '13 at 10:28









          Karthik T

          769510




          769510








          • 1




            parted is not installed. Also the drives are not mounted yet.
            – user4951
            Jan 9 '13 at 10:45






          • 1




            @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
            – Karthik T
            Jan 9 '13 at 12:24






          • 2




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
            – user4951
            Jan 10 '13 at 2:34










          • Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
            – Basile Starynkevitch
            Jan 18 '16 at 8:18
















          • 1




            parted is not installed. Also the drives are not mounted yet.
            – user4951
            Jan 9 '13 at 10:45






          • 1




            @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
            – Karthik T
            Jan 9 '13 at 12:24






          • 2




            +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
            – Warren Young
            Jan 9 '13 at 16:45










          • While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
            – user4951
            Jan 10 '13 at 2:34










          • Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
            – Basile Starynkevitch
            Jan 18 '16 at 8:18










          1




          1




          parted is not installed. Also the drives are not mounted yet.
          – user4951
          Jan 9 '13 at 10:45




          parted is not installed. Also the drives are not mounted yet.
          – user4951
          Jan 9 '13 at 10:45




          1




          1




          @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
          – Karthik T
          Jan 9 '13 at 12:24




          @JimThio I assume you were able to install it? You should be able to get it by simply doing sudo apt-get install parted (or gparted) if you are on Ubuntu or any other debian derivative.
          – Karthik T
          Jan 9 '13 at 12:24




          2




          2




          +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
          – Warren Young
          Jan 9 '13 at 16:45




          +1: I've verified that this gives the correct result when mounting an ext2 filesystem with mount -t ext4. parted isn't fooled by that.
          – Warren Young
          Jan 9 '13 at 16:45












          While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
          – user4951
          Jan 10 '13 at 2:34




          While this is not the most upvoted answer, this is the one I actually use. Also I do not need to specify the device.
          – user4951
          Jan 10 '13 at 2:34












          Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
          – Basile Starynkevitch
          Jan 18 '16 at 8:18






          Because it is not the best answer: a partition might be grub-labeled as ext2 and contains ext4 filesystem (and then would be mounted as ext4 with mount -t auto)
          – Basile Starynkevitch
          Jan 18 '16 at 8:18













          15














          Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list:



          # tune2fs -l /dev/sda1 | grep features


          If in the list you see:





          • extent — it's ext4

          • no extent, but has_journal — it's ext3

          • neither extent nor has_journal — it's ext2


          The parted and blkid answers are better if you want these heuristics run for you automatically. (They tell the difference with feature checks, too.) They can also identify non-ext? filesystems.



          This method has the virtue of showing you the low-level differences.



          The important thing to realize here is that these three filesystems are forwards compatible, and to some extent backwards-compatible, too. Later versions just add features on top of the older ones.



          See the ext4 HOWTO for more information on this.






          share|improve this answer




























            15














            Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list:



            # tune2fs -l /dev/sda1 | grep features


            If in the list you see:





            • extent — it's ext4

            • no extent, but has_journal — it's ext3

            • neither extent nor has_journal — it's ext2


            The parted and blkid answers are better if you want these heuristics run for you automatically. (They tell the difference with feature checks, too.) They can also identify non-ext? filesystems.



            This method has the virtue of showing you the low-level differences.



            The important thing to realize here is that these three filesystems are forwards compatible, and to some extent backwards-compatible, too. Later versions just add features on top of the older ones.



            See the ext4 HOWTO for more information on this.






            share|improve this answer


























              15












              15








              15






              Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list:



              # tune2fs -l /dev/sda1 | grep features


              If in the list you see:





              • extent — it's ext4

              • no extent, but has_journal — it's ext3

              • neither extent nor has_journal — it's ext2


              The parted and blkid answers are better if you want these heuristics run for you automatically. (They tell the difference with feature checks, too.) They can also identify non-ext? filesystems.



              This method has the virtue of showing you the low-level differences.



              The important thing to realize here is that these three filesystems are forwards compatible, and to some extent backwards-compatible, too. Later versions just add features on top of the older ones.



              See the ext4 HOWTO for more information on this.






              share|improve this answer














              Still another way, since you know you're running some flavor of ext?, is to look at the filesystem's feature list:



              # tune2fs -l /dev/sda1 | grep features


              If in the list you see:





              • extent — it's ext4

              • no extent, but has_journal — it's ext3

              • neither extent nor has_journal — it's ext2


              The parted and blkid answers are better if you want these heuristics run for you automatically. (They tell the difference with feature checks, too.) They can also identify non-ext? filesystems.



              This method has the virtue of showing you the low-level differences.



              The important thing to realize here is that these three filesystems are forwards compatible, and to some extent backwards-compatible, too. Later versions just add features on top of the older ones.



              See the ext4 HOWTO for more information on this.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jan 9 '13 at 15:36

























              answered Jan 9 '13 at 15:28









              Warren Young

              54.6k10142146




              54.6k10142146























                  9














                  try using df -T see man df for more options still one more way I found is cfdisk






                  share|improve this answer



















                  • 2




                    This has the same weakness as h3rmiller's mount based answer.
                    – Warren Young
                    Jan 9 '13 at 16:38






                  • 3




                    h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                    – Warren Young
                    Jan 9 '13 at 18:19












                  • @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                    – mattdm
                    Jan 9 '13 at 19:05










                  • @mattdm: So when you unmount it...is it still an ext4 filesystem?
                    – Warren Young
                    Jan 9 '13 at 19:26










                  • @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                    – mattdm
                    Jan 9 '13 at 19:32


















                  9














                  try using df -T see man df for more options still one more way I found is cfdisk






                  share|improve this answer



















                  • 2




                    This has the same weakness as h3rmiller's mount based answer.
                    – Warren Young
                    Jan 9 '13 at 16:38






                  • 3




                    h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                    – Warren Young
                    Jan 9 '13 at 18:19












                  • @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                    – mattdm
                    Jan 9 '13 at 19:05










                  • @mattdm: So when you unmount it...is it still an ext4 filesystem?
                    – Warren Young
                    Jan 9 '13 at 19:26










                  • @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                    – mattdm
                    Jan 9 '13 at 19:32
















                  9












                  9








                  9






                  try using df -T see man df for more options still one more way I found is cfdisk






                  share|improve this answer














                  try using df -T see man df for more options still one more way I found is cfdisk







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 9 '13 at 16:51

























                  answered Jan 9 '13 at 10:30









                  harish.venkat

                  4,4431924




                  4,4431924








                  • 2




                    This has the same weakness as h3rmiller's mount based answer.
                    – Warren Young
                    Jan 9 '13 at 16:38






                  • 3




                    h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                    – Warren Young
                    Jan 9 '13 at 18:19












                  • @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                    – mattdm
                    Jan 9 '13 at 19:05










                  • @mattdm: So when you unmount it...is it still an ext4 filesystem?
                    – Warren Young
                    Jan 9 '13 at 19:26










                  • @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                    – mattdm
                    Jan 9 '13 at 19:32
















                  • 2




                    This has the same weakness as h3rmiller's mount based answer.
                    – Warren Young
                    Jan 9 '13 at 16:38






                  • 3




                    h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                    – Warren Young
                    Jan 9 '13 at 18:19












                  • @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                    – mattdm
                    Jan 9 '13 at 19:05










                  • @mattdm: So when you unmount it...is it still an ext4 filesystem?
                    – Warren Young
                    Jan 9 '13 at 19:26










                  • @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                    – mattdm
                    Jan 9 '13 at 19:32










                  2




                  2




                  This has the same weakness as h3rmiller's mount based answer.
                  – Warren Young
                  Jan 9 '13 at 16:38




                  This has the same weakness as h3rmiller's mount based answer.
                  – Warren Young
                  Jan 9 '13 at 16:38




                  3




                  3




                  h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                  – Warren Young
                  Jan 9 '13 at 18:19






                  h3rrmiller removed his answer, so for those who don't have the rep to see it now, the problem is that if you say mount -t ext4 on an ext2 filesystem, df -T reports ext4. That is, it's just reading what the mount table says, not looking at the filesystem metadata to figure this out.
                  – Warren Young
                  Jan 9 '13 at 18:19














                  @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                  – mattdm
                  Jan 9 '13 at 19:05




                  @Warren: That's because it is an ext4 filesystem in that case. Just one with not many features.
                  – mattdm
                  Jan 9 '13 at 19:05












                  @mattdm: So when you unmount it...is it still an ext4 filesystem?
                  – Warren Young
                  Jan 9 '13 at 19:26




                  @mattdm: So when you unmount it...is it still an ext4 filesystem?
                  – Warren Young
                  Jan 9 '13 at 19:26












                  @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                  – mattdm
                  Jan 9 '13 at 19:32






                  @Warren: in a sense, all ext2 filesystems are also ext4 filesystems, yes. (But of course, not in the sense most people mean.)
                  – mattdm
                  Jan 9 '13 at 19:32













                  8














                  Surprised this isn't on here already.
                  No sudo required:



                  lsblk -f






                  share|improve this answer





















                  • If I run this without sudo the FSTYPE column is blank.
                    – Flup
                    Jul 15 '15 at 14:45










                  • @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                    – Freedom_Ben
                    Jul 18 '15 at 1:50












                  • @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                    – don_crissti
                    Sep 3 '15 at 22:00
















                  8














                  Surprised this isn't on here already.
                  No sudo required:



                  lsblk -f






                  share|improve this answer





















                  • If I run this without sudo the FSTYPE column is blank.
                    – Flup
                    Jul 15 '15 at 14:45










                  • @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                    – Freedom_Ben
                    Jul 18 '15 at 1:50












                  • @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                    – don_crissti
                    Sep 3 '15 at 22:00














                  8












                  8








                  8






                  Surprised this isn't on here already.
                  No sudo required:



                  lsblk -f






                  share|improve this answer












                  Surprised this isn't on here already.
                  No sudo required:



                  lsblk -f







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 25 '14 at 20:52









                  Freedom_Ben

                  77421319




                  77421319












                  • If I run this without sudo the FSTYPE column is blank.
                    – Flup
                    Jul 15 '15 at 14:45










                  • @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                    – Freedom_Ben
                    Jul 18 '15 at 1:50












                  • @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                    – don_crissti
                    Sep 3 '15 at 22:00


















                  • If I run this without sudo the FSTYPE column is blank.
                    – Flup
                    Jul 15 '15 at 14:45










                  • @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                    – Freedom_Ben
                    Jul 18 '15 at 1:50












                  • @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                    – don_crissti
                    Sep 3 '15 at 22:00
















                  If I run this without sudo the FSTYPE column is blank.
                  – Flup
                  Jul 15 '15 at 14:45




                  If I run this without sudo the FSTYPE column is blank.
                  – Flup
                  Jul 15 '15 at 14:45












                  @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                  – Freedom_Ben
                  Jul 18 '15 at 1:50






                  @Flup I just tried it myself again and it worked perfectly without sudo. FSTYPE column was fully populated. May be some disparity between our systems?
                  – Freedom_Ben
                  Jul 18 '15 at 1:50














                  @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                  – don_crissti
                  Sep 3 '15 at 22:00




                  @Flup - you must be using Debian/Ubuntu or derivatives... They're famous for doing something (or maybe not doing something, I wouldn't know) and the end result is you need root privileges to list some lsblk columns...
                  – don_crissti
                  Sep 3 '15 at 22:00











                  3














                  use -T option to print file system type



                  [root@centos6 ~]# df -T

                  Filesystem Type 1K-blocks Used Available Use% Mounted on
                  /dev/mapper/VolGroup-lv_root
                  ext4 6795192 6367072 76276 99% /
                  tmpfs tmpfs 639164 0 639164 0% /dev/shm
                  /dev/sda1 ext4 487652 28684 433368 7% /boot





                  share|improve this answer


























                    3














                    use -T option to print file system type



                    [root@centos6 ~]# df -T

                    Filesystem Type 1K-blocks Used Available Use% Mounted on
                    /dev/mapper/VolGroup-lv_root
                    ext4 6795192 6367072 76276 99% /
                    tmpfs tmpfs 639164 0 639164 0% /dev/shm
                    /dev/sda1 ext4 487652 28684 433368 7% /boot





                    share|improve this answer
























                      3












                      3








                      3






                      use -T option to print file system type



                      [root@centos6 ~]# df -T

                      Filesystem Type 1K-blocks Used Available Use% Mounted on
                      /dev/mapper/VolGroup-lv_root
                      ext4 6795192 6367072 76276 99% /
                      tmpfs tmpfs 639164 0 639164 0% /dev/shm
                      /dev/sda1 ext4 487652 28684 433368 7% /boot





                      share|improve this answer












                      use -T option to print file system type



                      [root@centos6 ~]# df -T

                      Filesystem Type 1K-blocks Used Available Use% Mounted on
                      /dev/mapper/VolGroup-lv_root
                      ext4 6795192 6367072 76276 99% /
                      tmpfs tmpfs 639164 0 639164 0% /dev/shm
                      /dev/sda1 ext4 487652 28684 433368 7% /boot






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jan 18 '16 at 7:59









                      LawrenceLi

                      8517




                      8517























                          2














                          fdisk -l
                          will list



                          Usage:



                           fdisk [options] -l <disk> list partition table(s)
                          fdisk -s <partition> give partition size(s) in blocks
                          fdisk [options] <disk> change partition table





                          share|improve this answer



















                          • 2




                            On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                            – Warren Young
                            Jan 9 '13 at 20:17












                          • +1 for effort. I have done fdisk before asking this question. Keep points up.
                            – user4951
                            Jan 10 '13 at 2:35
















                          2














                          fdisk -l
                          will list



                          Usage:



                           fdisk [options] -l <disk> list partition table(s)
                          fdisk -s <partition> give partition size(s) in blocks
                          fdisk [options] <disk> change partition table





                          share|improve this answer



















                          • 2




                            On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                            – Warren Young
                            Jan 9 '13 at 20:17












                          • +1 for effort. I have done fdisk before asking this question. Keep points up.
                            – user4951
                            Jan 10 '13 at 2:35














                          2












                          2








                          2






                          fdisk -l
                          will list



                          Usage:



                           fdisk [options] -l <disk> list partition table(s)
                          fdisk -s <partition> give partition size(s) in blocks
                          fdisk [options] <disk> change partition table





                          share|improve this answer














                          fdisk -l
                          will list



                          Usage:



                           fdisk [options] -l <disk> list partition table(s)
                          fdisk -s <partition> give partition size(s) in blocks
                          fdisk [options] <disk> change partition table






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Dec 20 '18 at 4:08









                          Sergiy Kolodyazhnyy

                          8,29212152




                          8,29212152










                          answered Jan 9 '13 at 19:03









                          resultsway

                          1213




                          1213








                          • 2




                            On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                            – Warren Young
                            Jan 9 '13 at 20:17












                          • +1 for effort. I have done fdisk before asking this question. Keep points up.
                            – user4951
                            Jan 10 '13 at 2:35














                          • 2




                            On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                            – Warren Young
                            Jan 9 '13 at 20:17












                          • +1 for effort. I have done fdisk before asking this question. Keep points up.
                            – user4951
                            Jan 10 '13 at 2:35








                          2




                          2




                          On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                          – Warren Young
                          Jan 9 '13 at 20:17






                          On what system? fdisk, on the system I'm using at the moment at least, only shows the partition type, not the filesystem type. That means not only can't it tell the difference between ext2, ext3, and ext4, it also can't discern ReiserFS or XFS from these.
                          – Warren Young
                          Jan 9 '13 at 20:17














                          +1 for effort. I have done fdisk before asking this question. Keep points up.
                          – user4951
                          Jan 10 '13 at 2:35




                          +1 for effort. I have done fdisk before asking this question. Keep points up.
                          – user4951
                          Jan 10 '13 at 2:35











                          1














                          Here's a useful oneliner to get just the filesystem type:



                          blkid -o export <partition-device> | grep '^TYPE' | cut -d"=" -f2


                          An example run is:



                          # blkid -o export /dev/sda1 | grep '^TYPE' | cut -d"=" -f2
                          vfat
                          # blkid -o export /dev/sda2 | grep '^TYPE' | cut -d"=" -f2
                          ext4





                          share|improve this answer


























                            1














                            Here's a useful oneliner to get just the filesystem type:



                            blkid -o export <partition-device> | grep '^TYPE' | cut -d"=" -f2


                            An example run is:



                            # blkid -o export /dev/sda1 | grep '^TYPE' | cut -d"=" -f2
                            vfat
                            # blkid -o export /dev/sda2 | grep '^TYPE' | cut -d"=" -f2
                            ext4





                            share|improve this answer
























                              1












                              1








                              1






                              Here's a useful oneliner to get just the filesystem type:



                              blkid -o export <partition-device> | grep '^TYPE' | cut -d"=" -f2


                              An example run is:



                              # blkid -o export /dev/sda1 | grep '^TYPE' | cut -d"=" -f2
                              vfat
                              # blkid -o export /dev/sda2 | grep '^TYPE' | cut -d"=" -f2
                              ext4





                              share|improve this answer












                              Here's a useful oneliner to get just the filesystem type:



                              blkid -o export <partition-device> | grep '^TYPE' | cut -d"=" -f2


                              An example run is:



                              # blkid -o export /dev/sda1 | grep '^TYPE' | cut -d"=" -f2
                              vfat
                              # blkid -o export /dev/sda2 | grep '^TYPE' | cut -d"=" -f2
                              ext4






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 9 '16 at 13:20









                              Diego

                              1134




                              1134























                                  0














                                  This didn't show the BSD answer I was looking for. I had the impression these type bytes were actually contained in the partition table on the disk, not sure about that. There's only type 85 for all Linux extfs types, but Linux doesn't recognize OpenBSD's A6 type at all either.




                                  > 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD
                                  > 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot
                                  > 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+
                                  > 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy*
                                  > 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap
                                  > 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris
                                  > 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS
                                  > 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12
                                  > 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M
                                  > 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled
                                  > 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C*
                                  > 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint
                                  > 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor
                                  > 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor
                                  > 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor
                                  > 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386
                                  > 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT
                                  > 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys
                                  > 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor
                                  > 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec
                                  > 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor
                                  > 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT
                                  > 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X


                                  The formatting may get mangled, it's a nice table 70 columns wide. If you're in OpenBSD's fdisk and you hit ? when it asks for partition type this is what you get. The types show when you're editing or listing the partition table.



                                  Partition types on Wikipedia: https://en.wikipedia.org/wiki/Partition_type






                                  share|improve this answer




























                                    0














                                    This didn't show the BSD answer I was looking for. I had the impression these type bytes were actually contained in the partition table on the disk, not sure about that. There's only type 85 for all Linux extfs types, but Linux doesn't recognize OpenBSD's A6 type at all either.




                                    > 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD
                                    > 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot
                                    > 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+
                                    > 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy*
                                    > 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap
                                    > 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris
                                    > 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS
                                    > 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12
                                    > 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M
                                    > 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled
                                    > 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C*
                                    > 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint
                                    > 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor
                                    > 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor
                                    > 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor
                                    > 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386
                                    > 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT
                                    > 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys
                                    > 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor
                                    > 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec
                                    > 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor
                                    > 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT
                                    > 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X


                                    The formatting may get mangled, it's a nice table 70 columns wide. If you're in OpenBSD's fdisk and you hit ? when it asks for partition type this is what you get. The types show when you're editing or listing the partition table.



                                    Partition types on Wikipedia: https://en.wikipedia.org/wiki/Partition_type






                                    share|improve this answer


























                                      0












                                      0








                                      0






                                      This didn't show the BSD answer I was looking for. I had the impression these type bytes were actually contained in the partition table on the disk, not sure about that. There's only type 85 for all Linux extfs types, but Linux doesn't recognize OpenBSD's A6 type at all either.




                                      > 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD
                                      > 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot
                                      > 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+
                                      > 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy*
                                      > 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap
                                      > 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris
                                      > 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS
                                      > 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12
                                      > 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M
                                      > 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled
                                      > 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C*
                                      > 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint
                                      > 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor
                                      > 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor
                                      > 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor
                                      > 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386
                                      > 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT
                                      > 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys
                                      > 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor
                                      > 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec
                                      > 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor
                                      > 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT
                                      > 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X


                                      The formatting may get mangled, it's a nice table 70 columns wide. If you're in OpenBSD's fdisk and you hit ? when it asks for partition type this is what you get. The types show when you're editing or listing the partition table.



                                      Partition types on Wikipedia: https://en.wikipedia.org/wiki/Partition_type






                                      share|improve this answer














                                      This didn't show the BSD answer I was looking for. I had the impression these type bytes were actually contained in the partition table on the disk, not sure about that. There's only type 85 for all Linux extfs types, but Linux doesn't recognize OpenBSD's A6 type at all either.




                                      > 00 unused 20 Willowsoft 66 NetWare 386 A9 NetBSD
                                      > 01 DOS FAT-12 24 NEC DOS 67 Novell AB MacOS X boot
                                      > 02 XENIX / 27 Win Recovery 68 Novell AF MacOS X HFS+
                                      > 03 XENIX /usr 38 Theos 69 Novell B7 BSDI filesy*
                                      > 04 DOS FAT-16 39 Plan 9 70 DiskSecure B8 BSDI swap
                                      > 05 Extended DOS 40 VENIX 286 75 PCIX BF Solaris
                                      > 06 DOS > 32MB 41 Lin/Minux DR 80 Minix (old) C0 CTOS
                                      > 07 NTFS 42 LinuxSwap DR 81 Minix (new) C1 DRDOSs FAT12
                                      > 08 AIX fs 43 Linux DR 82 Linux swap C4 DRDOSs 09 AIX/Coherent 4D QNX 4.2 Pri 83 Linux files* C6 DRDOSs >=32M
                                      > 0A OS/2 Bootmgr 4E QNX 4.2 Sec 84 OS/2 hidden C7 HPFS Disbled
                                      > 0B Win95 FAT-32 4F QNX 4.2 Ter 85 Linux ext. DB CPM/C.DOS/C*
                                      > 0C Win95 FAT32L 50 DM 86 NT FAT VS DE Dell Maint
                                      > 0E DOS FAT-16 51 DM 87 NTFS VS E1 SpeedStor
                                      > 0F Extended LBA 52 CP/M or SysV 8E Linux LVM E3 SpeedStor
                                      > 10 OPUS 53 DM 93 Amoeba FS E4 SpeedStor
                                      > 11 OS/2 hidden 54 Ontrack 94 Amoeba BBT EB BeOS/i386
                                      > 12 Compaq Diag. 55 EZ-Drive 99 Mylex EE EFI GPT
                                      > 14 OS/2 hidden 56 Golden Bow 9F BSDI EF EFI Sys
                                      > 16 OS/2 hidden 5C Priam A0 NotebookSave F1 SpeedStor
                                      > 17 OS/2 hidden 61 SpeedStor A5 FreeBSD F2 DOS 3.3+ Sec
                                      > 18 AST swap 63 ISC, HURD, * A6 OpenBSD F4 SpeedStor
                                      > 19 Willowtech 64 NetWare 2.xx A7 NEXTSTEP FF Xenix BBT
                                      > 1C ThinkPad Rec 65 NetWare 3.xx A8 MacOS X


                                      The formatting may get mangled, it's a nice table 70 columns wide. If you're in OpenBSD's fdisk and you hit ? when it asks for partition type this is what you get. The types show when you're editing or listing the partition table.



                                      Partition types on Wikipedia: https://en.wikipedia.org/wiki/Partition_type







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Feb 22 '17 at 22:23

























                                      answered Feb 22 '17 at 21:44









                                      Alan Corey

                                      493




                                      493






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f60723%2fhow-do-i-know-if-a-partition-is-ext2-ext3-or-ext4%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Morgemoulin

                                          Scott Moir

                                          Souastre