There are several ways to determine a drives filesystem type. Here's a list of the tools I'm familiar with.
1. blkid
Works whether device is mounted or not.
$ blkid
/dev/sda1: UUID="XXXX" TYPE="ext4"
/dev/sda2: UUID="XXXX" TYPE="LVM2_member"
2. mount
This is only useful once the block device has been mounted.
$ sudo mount | grep /dev/sda1
/dev/sda1 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
3. lsblk
Shows drive topologies, but not the filesystem types on the devices.
$ sudo lsblk -a
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 465.3G 0 part
tune2fs
$ tune2fs -l /dev/sda1 | grep magic
Filesystem magic number: 0xEF53
Shows the magic number associated with the device, you can look these up on this site, Linux Magic Numbers. It's also in a file, often here, /usr/share/magic
. You can locate it using locate /magic
.
dumpe2fs
$ sudo dumpe2fs /dev/sda1 | grep magic
dumpe2fs 1.42.7 (21-Jan-2013)
Filesystem magic number: 0xEF53
Same things apply as in tune2fs
.
/dev/mounts
This is the "file" maintained by the kernel that's used to display devices that have been mounted. NOTE: many of the tools on this list are typically using the contents of this file.
$ sudo cat /proc/mounts | grep /dev/sda1
/dev/sda1 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
file
You can also use the file
command to display info about unmounted filesystems.
$ sudo file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (needs journal recovery) (extents) (huge files)
An alternative syntax (as root):
$ file - </dev/sda1
/dev/stdin: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (needs journal recovery) (extents) (huge files)
Your mounting issue
I'd suspect that the filesystem you're attempting to mount is not what you think it is. Either the entire device was formatted with a filesystem (/dev/sda
), in which case you'd be mounting the entire drive. You can test this hypothesis like this:
$ sudo mount /dev/sda /mnt
Of if you need to explicitly tell what filesystem to use:
$ sudo mount -o ext2 /dev/sda /mnt
NOTE: This is generally not the case that an entire filesystem is laid down on the entire device, /dev/sda
, rather they're partitioned into /dev/sda1
, etc.
Or perhaps the drive has been partitioned. In this case you'd see these partitions with the above command lsblk
, where they'd show up as /dev/sda1
, /dev/sda2
, etc. If that's the case for you then you'll need to mount the partition instead like so:
$ sudo mount /dev/sda1 /mnt
Again pay special attention to the formatting used on the filesystem of the device, you'll occasionally have to specify it literally to mount
.
Since your output from fdisk
shows that you have /dev/sda1
I'd be inclined to think that you have your filesystem on the 1st partition.
Device Boot Start End Blocks Id System
/dev/sda1 63 1953520064 976760001 83 Linux
So mounting it like this should do the trick:
$ sudo mount -o ext2 /dev/sda1 /mnt
/etc/fstab
If the above mounting commands work then you can add this to your /etc/fstab
file.
/dev/sda1 /media/HDD ext2 defaults 0 2
Best Answer
Alternatively you could put the mount command you use at the commandline in
/etc/rc.local
.