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.
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.
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)
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
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
'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)]
Ugh... looking at /etc/fstab doesn't seem a bad idea if the filesystem is internal.
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)]
'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
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)]
Bookmarks