LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't mount second hard drive, wrong fs type? (https://www.linuxquestions.org/questions/linux-newbie-8/cant-mount-second-hard-drive-wrong-fs-type-473375/)

lerad512 08-12-2006 10:01 PM

Can't mount second hard drive, wrong fs type?
 
Great sites like this convinced me to switch to Linux at home. I'm still a newbie, though, so I'll need some help.

In addition to a primary hard drive (where Kubuntu is installed), I've got a second drive that I'm having trouble mounting. When I try to mount it from the KDE GUI, I get an error that says, "mount: can't find /dev/hdb1 in /etc/fstab or /etc/mtab". When I try from the command line by typing "sudo mount -t ntfs /dev/sdb1 /media/sdb1", I get an error that says, "mount: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or other error".

My guess is that I'm having this problem because the drive is still NTSF, from when I was running Windows. Maybe I need to install NTSF support into the OS, or something? (I'd be surprised if that's it; I have two external hard drives that I believe are NTSF, and I can mount them with no problem.) I probably just need to add the right thing to fstab, but I don't know what that thing is. If anyone could give me a hand, I'd appreciate it!

Here's the contents of /etc/fstab:

# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0

zhangmaike 08-12-2006 10:31 PM

After you try to mount /dev/sdb1 (sudo mount -t ntfs /dev/sdb1 /media/sdb1) and it gives you that error, try:
Code:

dmesg | tail
That will print out the last few lines of the kernel log. More details about the error will be available there. Post them.

By the way, are you sure that it's ntfs? The filesystem of a device that you want to mount can often be detected without being specified on the command line. Try the same mount command but omit the -t ntfs part.

lord-fu 08-12-2006 11:33 PM

My guess is that there is no hdb1 entry in /etc/fstab
Quote:

I get an error that says, "mount: can't find /dev/hdb1 in /etc/fstab or /etc/mtab".
Quote:

Here's the contents of /etc/fstab:

# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
Add an entry for that drive and all should be ok.
/dev/hdb1 /mnt/foldername ntfs auto,users,rw 0 0

I know that on my systems I have to have ntfs support compiled into the kernel, I don't know if kubuntu has this by default.

Hope that helps.

lerad512 08-12-2006 11:47 PM

Well, I wasn't sure that it's NTSF, you're right. And after looking at the kernel log, it looks like it isn't. Here's the last bit:

[17181723.804000] NTFS-fs error (device sdb1): read_ntfs_boot_sector(): Primary boot sector is invalid.
[17181723.808000] NTFS-fs error (device sdb1): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.
[17181723.808000] NTFS-fs error (device sdb1): ntfs_fill_super(): Not an NTFS volume.

I tried "sudo mount /dev/sdb1 /media/sdb1", and got an error that says, "mount: you must specify the filesystem type". I tried a couple other variations, too: "-t vfat" got me the same sort of error as with NTFS, and "-t auto" was not recognized.

Thanks for your help so far. If anyone has more insight, I'd appreciate it.

lerad512 08-13-2006 12:26 AM

I added an entry to /etc/fstab: "/dev/hdb1 /mnt/hdb1 ntfs auto,users,rw 0 0" and created a hdb1 directory in /mnt. It sort of seems like it did something. At least, when I ran "sudo mount -a", it didn't generate any errors. But I can't access "/mnt/hdb1". When I try in KDE, it gives me "Could not enter folder /mnt/hdb1" and when I try in the console I get "bash: cd: /mnt/hdb1: Permission denied".

Under "ls -al" the directory looks like this:

dr-x------ 1 root root 12288 2006-08-12 09:02 hdb1

I thought that maybe that was the source of the permissions error, but if I try to broaden the permissions or change its ownership, I get an error that says, "Read-only file system".

zhangmaike 08-13-2006 02:00 AM

A directory must have execute permissions for you to enter it with cd. For that directory (according to the output from ls), only root has execute permissions, and the owner group and other users do not. Read permissions for the other users couldn't hurt either.

Do, as root:
Code:

chmod go+rx /mnt/hdb1
Quote:

I get an error that says, "Read-only file system".
If the mount did succeed, you might have to unmount it first. The linux kernel has read support for ntfs, but no real write support. If it has been mounted, it would've been mounted read-only... I'd guess that's where this error is coming from.

lerad512 08-13-2006 01:24 PM

When I unmount the drive I can chmod, but when I mount the drive again the permissions go back to what I posted above and I can't enter the directory.

Is there a way to tell what filesystem I've got on this drive? Like I said before, I'm not sure it's NTFS, but I don't know what else it might be. Better yet would be to have it auto-detect when it mounts but that option doesn't seem to work.

zhangmaike 08-13-2006 04:12 PM

Since the entry in fstab specifies ntfs, and it mounts properly, I'd guess that the filesystem is indeed ntfs. Here's an excerpt from the mount
manpage about options for ntfs:
Code:

      uid=value, gid=value and umask=value
              Set the file permission on the filesystem.  The umask  value  is
              given in octal.  By default, the files are owned by root and not
              readable by somebody else.

It seems the r-x------ permissions might be a result of the default options. Try specifying umask=000 in your list of options in fstab - this will not restrict the permissions at all (although you may want to tighten this down after testing is through). Setting umask=022 would probably be a better choice... this gives write permissions only to the owner and read/execute permissions to everyone.

lerad512 08-13-2006 10:24 PM

Victory! The new entry in /etc/fstab is:
Code:

/dev/hdb1 /mnt/hdb1 ntfs auto,users,ro,umask=022 0 0
Now I can mount the drive with no problem. Thanks so much for your help!


All times are GMT -5. The time now is 05:51 AM.