thelini
Posts: 42
Joined: Fri Feb 24, 2012 9:52 am

External HDD can't mount?

Mon May 21, 2012 9:22 am

I have an external HDD and am struggling to get it to mount.

The file manager in Debian can see the drive, but it is not mounted and I get the error not authroised when I try to mount it.

Is there a way I should format the drive, would ntfs work or does it have to be ext?

Any info would be a great help.

I do apologise but my Linux knowledge is very basic.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: External HDD can't mount?

Mon May 21, 2012 9:26 am

Which commands are you using to mount the drive?
Is there a difference in the following command output, with the drive connected and disconnected?
ls /dev/sd*

thelini
Posts: 42
Joined: Fri Feb 24, 2012 9:52 am

Re: External HDD can't mount?

Mon May 21, 2012 9:34 am

For now all I have tried to do is use the file manager in Debian to mount it (right click option)

I take it I may be better off mounting this in CLI before going into x

Like I mentioned above I have limited Linux experience and am lacking any knowledge of how to mount drives via command line. But I am willing to learn.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: External HDD can't mount?

Mon May 21, 2012 9:41 am

The RPi should show the first external drive as /dev/sdb1

To mount an external drive, you can use the commands
sudo mkdir /mnt/external
sudo mount /dev/sdb1 /mnt/external

To check if the drive is mounted, use the command
ls /mnt/external

In the File Manager, you should find your files under /mnt/external

RobJN
Posts: 2
Joined: Mon May 21, 2012 11:45 am

Re: External HDD can't mount?

Mon May 21, 2012 12:04 pm

thelini,

Just to add some detail to bredman's answer. All the steps to mount a external drive are run in a command line (however this can be done once x is started by using a "terminal emulator" - LXTerminal in LXDE):

1. Find out the name of the device. To do use the command "sudo fdisk -l" (that's lowercase L). As noted the first external drive will probably be /dev/sdb1.

2. Where Windows assigns letters to new drives, in Linux we add them straight into the existing folder (directory) structure. It is common to use the /mnt directory. First create a new directory using any name you like (here we use "external") with "sudo mkdir /mnt/external".

3. Finally we mount the device to this new directory using "sudo mount /dev/sdb1 /mnt/external" or whatever /dev/ you wound in step 1.

note: all commands exclude the quotation marks in this example.

thelini
Posts: 42
Joined: Fri Feb 24, 2012 9:52 am

Re: External HDD can't mount?

Mon May 21, 2012 12:51 pm

Thanks for the info guys..

I'll have a look tonight. (I think my HD was appearing as /sda*/ but i'll double check that and give it all a try.

Cheers Much!!

User avatar
stevepdp
Posts: 285
Joined: Fri Oct 28, 2011 7:41 am
Contact: Website Twitter

Re: External HDD can't mount?

Mon May 21, 2012 12:51 pm

Don't forget that you might need to specify the filesystem, something like this:

Code: Select all

sudo mount -t ntfs-3g /dev/sdb1 /mnt/external
If a command like that doesn't mount it, report back what it's telling you. Sometimes Linux won't mount an NTFS drive if it suspects it was removed uncleanly, you could also be missing ntfs-3g and such.

In the case of a fat32 formatted disk, it would be something like:

Code: Select all

sudo mount -t vfat /dev/sdb1 /mnt/external

Nr90
Posts: 216
Joined: Sat Nov 26, 2011 12:39 pm

Re: External HDD can't mount?

Mon May 21, 2012 4:11 pm

thelini wrote:For now all I have tried to do is use the file manager in Debian to mount it (right click option)

I take it I may be better off mounting this in CLI before going into x

Like I mentioned above I have limited Linux experience and am lacking any knowledge of how to mount drives via command line. But I am willing to learn.
Agreed with the others guys posting, one extra bit is that you need root privileges to mount a drive. When you run the filemanager it is started under your user's account, therefor it cannot mount a drive.

The command umount will unmount the drive after you are done with it.

thelini
Posts: 42
Joined: Fri Feb 24, 2012 9:52 am

Re: External HDD can't mount?

Tue May 22, 2012 3:42 pm

Thanks for the info guys..

Got it up and running and a samba share running of it

I used..

Code: Select all

sudo mount /dev/sda1 /mnt/external
It is an ntfs formatted drive and I did not need to add the flags for the ntfs disk.

So now I need to add this to startup.

What file do i need to edit to do this?

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: External HDD can't mount?

Tue May 22, 2012 5:39 pm

Unless something has seriously changed ;) you edit the /etc/fstab file. Must be edited as root (so run... sudo nano /etc/fstab)
You'll see the following format:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 0
/dev/mmcblk0p3 none swap sw 0 0

dc4-arm-01:/home/grayg/stage/debpi_pubsd/root/mnt/opt/vc /opt/vc nfs defaults 0 0

or similar (this is from the old Debian image).
to explain a line.
Device block (ie /dev/sda1), mount location (ie /mnt/external) filesystem (ie auto - lets make life flexible), mount options (see below), dumping and checking priorities - leave as 0.

/dev/sda1 [\t] /mnt/external [\t] auto [\t] ro,auto,users [\t] 0 [\t] 0
[\t] = use a tab character not a space :)

Options:
ro = read only, you don't want this if you need to write to the drive (it's rare that you'd want it, but I thought I'd let you know it existed)*.
noauto = do not auto mount at boot.
users = allow users to mount and unmount the drive (if it wasn't plugged in at boot).

You don't normally have users without noauto, because most stuff that you mount at boot is expected to always be there. You would normally have noauto and users together as the user generally wants full read and write access to the physical device they keep in their pocket.
* Read up on the stability of NTFS writing under Linux - you may actually need the drive as read only after all.

Google and 'man fstab' can offer lots more.


you can then mount with
mount /mnt/external

thelini
Posts: 42
Joined: Fri Feb 24, 2012 9:52 am

Re: External HDD can't mount?

Thu May 24, 2012 12:13 pm

Thanks a lot Steady Bear

Thats worked a treat

NTFS is working fine, but is pulling approx 30% cpu when reading & writing.

victagayun
Posts: 127
Joined: Sun Apr 15, 2012 4:01 pm
Contact: Website

Re: External HDD can't mount?

Mon Jun 25, 2012 8:16 am

thelini wrote:For now all I have tried to do is use the file manager in Debian to mount it (right click option)

I take it I may be better off mounting this in CLI before going into x

Like I mentioned above I have limited Linux experience and am lacking any knowledge of how to mount drives via command line. But I am willing to learn.
hello thelini,
me too am quite new to debian/linux stuff. when i startx and use the filemanager all the external usb hard drives can be found in /media, while in ssh i cannot find the drives via "ls" command.
does it mean that:
when startx is not yet run and you are in some command prompt (ssh), you cannot use /media to share using samba and need to mount it by making a subdirectory inside /mnt?

i have used usbmount using sudo apt-get install usbmount but i can only read fat32 from win7 using samba, i have shared the /dev

i have ran debian using vmware and sucessfully shared /media so that i can share any external USB hard disks that is connected in the USB port. ihave used like this:

[usbshare]
path = /media
public =yes

im not sure if i need to go to the gui (invoke startx) to start sharing..
i hope to share all the usb connected hard disk via /media, i hope there are better ways than to make and mount every single drives there is, or even after reboot it should be fully automatic...

Return to “Beginners”