View previous topic :: View next topic |
Author |
Message |
humbletech99 Veteran
Joined: 26 May 2005 Posts: 1229 Location: London
|
Posted: Sat Feb 02, 2008 5:55 pm Post subject: Discover what filesystem(s) are on a disk/partition? |
|
|
Is there any really good linux program to definitively tell you what filesystem(s) are on a disk/partitions?
When you do mount /dev/sda1, for example, the mount program detects the filesystem type and then mounts the partition as that filesystem so you can use it. I am looking for a program to just run the check of what filesystem it is without mounting the filesystem. I suspect that "mount" does this detection by looking for signatures in the first by bytes of the partition in order to identify it, so there should be some other program that can do this too, right?
EDIT: as I was typing this, I realized that fdisk and parted must be able to do this and they seem to, although I haven't tried them on any random disks yet. If anyone knows of any other good programs for file system detection, could you pls post them here? _________________ The Human Equation:
value(geeks) > value(mundanes) |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Sat Feb 02, 2008 6:26 pm Post subject: |
|
|
file
# file -s /dev/hda1
/dev/hda1: x86 boot sector, Microsoft Windows XP Bootloader NTLDR
# file -s /dev/sda2
/dev/sda2: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files)
# file -s /dev/mapper/vg-ccache
/dev/mapper/vg-ccache: ReiserFS V3.6 block size 4096 (mounted or unclean) num blocks 1048576 r5 hash
EDIT:
fdisk doesn't care about file systems, it just shows partition types which has nothing to do with actual data on that partition.
no idea how parted does things. |
|
Back to top |
|
|
humbletech99 Veteran
Joined: 26 May 2005 Posts: 1229 Location: London
|
Posted: Sat Feb 02, 2008 7:13 pm Post subject: |
|
|
ah, I didn't realize that file could actually work on partitions as well but this makes sense for unix philosophy of abstracting everything as files...
That's what I thought about fdisk in fact, that it looks at partition type rather than reading the actual filesystem itself, there is no guarantee that they are the same thing...
thanks _________________ The Human Equation:
value(geeks) > value(mundanes) |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sat Feb 02, 2008 7:14 pm Post subject: |
|
|
parted /dev/sda print: | Model: ATA MAXTOR STM325082 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 132MB 132MB primary ext3 boot
2 132MB 905MB 773MB primary linux-swap
3 905MB 8916MB 8011MB primary ext3
4 8916MB 250GB 241GB primary lvm |
Parted is indeed able to detect filesystems on partitions. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
humbletech99 Veteran
Joined: 26 May 2005 Posts: 1229 Location: London
|
Posted: Sat Feb 02, 2008 7:20 pm Post subject: |
|
|
question is, does it just look at partition types and print that, or does it actually read the filesystem to determine it's structure? _________________ The Human Equation:
value(geeks) > value(mundanes) |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sat Feb 02, 2008 10:05 pm Post subject: |
|
|
humbletech99 wrote: | question is, does it just look at partition types and print that, or does it actually read the filesystem to determine it's structure? |
Don't know really. It reports what's on my filesystems without lying and nothing else matters to me in fact .
EDIT: you could just have a look at the source code to be sure otherwise. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
|