Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Determine is filesystem is Etx2 or Ext3 or Ext4?

  1. #1
    Join Date
    Nov 2008
    Location
    Ukraine, Rivne
    Beans
    10
    Distro
    Ubuntu 9.10 Karmic Koala

    Question Determine is filesystem is Etx2 or Ext3 or Ext4?

    Hello.

    How can i correctly determine the type of fyle system? What fields i should compare? As i understand,it is imposible to do this by revision_level field from superblock =\ Any ideas?...

    Thanks.

  2. #2
    Join Date
    Jun 2010
    Location
    UK
    Beans
    206
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    If it's mounted, you should be able to get the filesystem type from a plain mount command. First line of mine is:

    $ mount
    /dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)

  3. #3
    Join Date
    Nov 2008
    Location
    Ukraine, Rivne
    Beans
    10
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    Quote Originally Posted by DanielWaterworth View Post
    If it's mounted, you should be able to get the filesystem type from a plain mount command. First line of mine is:

    $ mount
    /dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
    Hm. And how i can do it except this? Just have superblock fields values and other technical information. I mean, i have a some hex editor and i can waching through the file system. How can i resolve the type?)

  4. #4
    Join Date
    May 2008
    Location
    UK
    Beans
    1,451
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    What is wrong with running mount - or something like that ?
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

  5. #5
    Join Date
    Nov 2008
    Beans
    479
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    I don't think there is a simple way to do this (like looking at a specific byte in the superblock).
    You can use blkid or file -s without having to mount the partition.
    5127d464-4548-4993-a138-f546f2fd2a33

  6. #6
    Join Date
    Jan 2006
    Location
    U.S.A.
    Beans
    971
    Distro
    Ubuntu 15.10 Wily Werewolf

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    'blkid', 'mount', 'cat /proc/mounts' are all good ways

    Another is 'cd /proc/fs' or 'cd /sys/fs' and look around (the devices will be listed under the filesystem type).

    'tune2fs -l <device>' is the best way to tell absolutely. It will tell you the filesystem magic number. Unfortunately, then you've got to figure out what filesystem that corresponds to. (This is how the system actually knows what filesystem it is. However, you can also tell by glancing at the filesystem features.
    Favorite man page quote: "The backreference \n, where n is a single digit, matches the substring previously matched by the nth parenthesized subexpression of the regular expression." [excerpt from grep(1)]

  7. #7
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    Ugh... looking at /etc/fstab doesn't seem a bad idea if the filesystem is internal.

  8. #8
    Join Date
    Jan 2006
    Location
    U.S.A.
    Beans
    971
    Distro
    Ubuntu 15.10 Wily Werewolf

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    Ugh... fstab is user-generated and not authoritative. In other words, it could be wrong.
    Favorite man page quote: "The backreference \n, where n is a single digit, matches the substring previously matched by the nth parenthesized subexpression of the regular expression." [excerpt from grep(1)]

  9. #9
    Join Date
    Nov 2008
    Beans
    479
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    'tune2fs -l <device>' is the best way to tell absolutely. It will tell you the filesystem magic number.

    It does not work for me. I have the same magic numbers for different filesystems.
    Code:
    arrange@lucid-lean:~$ sudo tune2fs -l /dev/sdb2 | grep magic
    Filesystem magic number:  0xEF53
    arrange@lucid-lean:~$ sudo tune2fs -l /dev/sdb1 | grep magic
    Filesystem magic number:  0xEF53
    arrange@lucid-lean:~$ sudo blkid /dev/sdb2
    /dev/sdb2: LABEL="hh" UUID="87435c1d-6517-4c85-b68d-2841ae91fa43" SEC_TYPE="ext2" TYPE="ext3" 
    arrange@lucid-lean:~$ sudo blkid /dev/sdb1
    /dev/sdb1: LABEL="Dokumenty" UUID="304a520a-0a97-4f94-abe1-a8fc6858040a" TYPE="ext4"
    5127d464-4548-4993-a138-f546f2fd2a33

  10. #10
    Join Date
    Jan 2006
    Location
    U.S.A.
    Beans
    971
    Distro
    Ubuntu 15.10 Wily Werewolf

    Re: Determine is filesystem is Etx2 or Ext3 or Ext4?

    Quote Originally Posted by arrange View Post
    'tune2fs -l <device>' is the best way to tell absolutely. It will tell you the filesystem magic number.

    It does not work for me. I have the same magic numbers for different filesystems.
    Code:
    arrange@lucid-lean:~$ sudo tune2fs -l /dev/sdb2 | grep magic
    Filesystem magic number:  0xEF53
    arrange@lucid-lean:~$ sudo tune2fs -l /dev/sdb1 | grep magic
    Filesystem magic number:  0xEF53
    arrange@lucid-lean:~$ sudo blkid /dev/sdb2
    /dev/sdb2: LABEL="hh" UUID="87435c1d-6517-4c85-b68d-2841ae91fa43" SEC_TYPE="ext2" TYPE="ext3" 
    arrange@lucid-lean:~$ sudo blkid /dev/sdb1
    /dev/sdb1: LABEL="Dokumenty" UUID="304a520a-0a97-4f94-abe1-a8fc6858040a" TYPE="ext4"
    It seems I have an incorrect understanding of the magic number -- it does not distinguish between different ext filesystems. I have confirmed this on my own systems (both a system using the ext4 driver for all ext systems and another system that does not do this).

    Disregard what I said about using the magic number for this purpose. (I think you can still use to type filesystems, but not to distinguish between ext sub-types.) Sorry for the confusion.
    Last edited by BoneKracker; June 12th, 2010 at 04:25 PM.
    Favorite man page quote: "The backreference \n, where n is a single digit, matches the substring previously matched by the nth parenthesized subexpression of the regular expression." [excerpt from grep(1)]

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •