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
Ok, the summary is that Nautilus uses GVFS and you need to tell udev to use GVFS too when reading the fstab entries, you can do this using:
/dev/block-device /mount/point auto x-gvfs-show,ro 0 0
x-gvfs-show
will tell udev and anyone interested to use the GVFS helper to mount the filesystem, so gvfs has all the control mounting, umounting, moving mount points, etc.
Lets see if we understand how are drives mounted in modern Linux systems with GUI's (specifically Nautilus):
Nautilus uses GVFS as backend to mount FTP, SMB, block devices, among other things into the file system. The tool that GNOME designed for such proposes is called called Disks is the one that modify the behavior of GVFS. Now here comes the fun.
Nautilus ignores anything that it wasn't mounted using GVFS (like using fstab) and gives you a very rudimentary control over this using udev (Nautilus doesn't ask GVFS to unmount or mount devices that were not manipulated using GVFS, that includes udev, fstab, mount and any other blob) such as just unmount and mount. Using the permissions and options stored in fstab/udev you can use these filesystems accordingly but you can't modify the behavior using GVFS. If something was mounted using sudo mount -o rw /dev/sda3
, nautilus tells udev that it doesn't have permissions to modify the mount point, so it pass the responsibility to udev which in turn ask polkit for permissions. If you had used GVFS, nautilus itself unmount the device without permissions, nor dialogs, etc.
Best Answer
Try to use UUID instead of using device name. Because the name of this device (/dev/sda3) depends on the order in which it was detected while booting, and this order can change. Type this command "blkid" without quote, the shell will display all the devices with UUID. Refer below:
Above is an example. Copy your device UUID, then replace with /dev/sda3. Then reboot your server. Hope this can solve your problem. Thank you.