LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I automount usb drives on server? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-automount-usb-drives-on-server-4175494786/)

Ryanms3030 02-13-2014 10:08 AM

How do I automount usb drives on server?
 
I'm trying to use usb drives for samba shares on my server. Having lots of problems but I feel like it's because the drives aren't mounting. This is on Centos 6.5. I just logged onto the gui and one drive popped up eventually and the other I had to mount through disk management. They both mount to /media and that's the path I'm using in my smb.conf and I can't connect to the shares but I feel like this is the problem that they are not mounted unless I log onto the server and then they auto mount after a long delay or I manually mount them. When the server is idle with no log on I imagine the drives are not mounted. Can I just edit fstab to add them?

Ryanms3030 02-13-2014 03:22 PM

1 Attachment(s)
How do I determine if the mount issue is my problem? When I mount a drive in the gui it is mounted /media/backup. I can access the drive through the gui and it's fine.

Now I am ssh into the server. I
Code:

cd /media
and then ls and I see backup listed. I can cd again to /backup but when I ls at this point I get no results. That makes me assume that the volume is not really mounted. I should be able to see the contents of the drive when I ls , correct?

I tried
Code:

mount /media/backup
and get:

Code:

[mntent]: line 6 in /etc/fstab is bad
mount: can't find /media/backup in /etc/fstab or /etc/mtab

If i try to mount the smb share on my laptop using Nautulis it gives me this prompt (see attachment). I enter my password which I set on the server by doing

Code:

smbpasswd -a ryan
when I enter the password in Natuilus , I get:


Unhandled error message: Failed to mount Windows share: Permission denied


My smb config looks like this:


[backup]
path = /media/backup
valid users = ryan
read only = No
guest ok = Yes
available = yes
browsable = yes
create mask = 0777
directory mask = 0777


The frustrating thing is I had this working before with the same drive and same settings on this server. I have since reintalled the OS to start from scratch but set everything up the same

Habitual 02-13-2014 03:32 PM

Check out my 1 blog entry for NTFS-related issue/help. ;)

Ryanms3030 02-13-2014 03:33 PM

quick update. I am using samba swat to manage the shares to make it as easy as possible. I just added myself to the admin group for the shares and I can mount the share but the folder is empty.

That leads me back to believing that the actually usb drive is not mounted properly on the server.

Ryanms3030 02-13-2014 03:34 PM

Quote:

Originally Posted by Habitual (Post 5117137)
Check out my 1 blog entry for NTFS-related issue/help. ;)

I will check it out. The usb drives in question are actually formated ext4

Habitual 02-13-2014 04:02 PM

Sorry about "that". I assumed NTFS for "some reason". :(

Make a
Code:

sudo /media/some_directory
and try mounting it manually first with
Code:

sudo mount -t auto /dev/sdXn    /media/some_directory
or possibly (not default)
Code:

sudo mount -t ext4 /dev/sdXn    /media/some_directory
if that works, then
Code:

/dev/sdXn        /media/some_directory          ext4        defaults        1  2
would be the /etc/fstab entry.
if you mounted it manually already

in terminal as root (or sudo) you can test the /etc/fstab using
Code:

sudo umount /media/some_directory
and then
Code:

sudo mount -a
/dev/sdXn <-- yours will be different.
Do you know how to find that out?

Let us know!

Ryanms3030 02-13-2014 04:05 PM

Quote:

Originally Posted by Habitual (Post 5117146)
/dev/sdXn <-- yours will be different.
Do you know how to find that out?

Let us know!

I don't know how to find that out. I know I can browse /dev but other then that I'm not sure. I know my usb drive should show up as sdb or sdc or something like that but I'm not sure how to determine which drive is which

Habitual 02-13-2014 04:06 PM

Plug the drive in (automount is ok if it does this)
and open terminal and type
Code:

mount | grep sd
or mount through disk management then "mount | grep sd"

show us the output.

John

Habitual 02-13-2014 04:31 PM

My "/media/some_directory" example is "/media/backup" in your case.

Ryanms3030 02-13-2014 04:37 PM

Quote:

Originally Posted by Habitual (Post 5117160)
My "/media/some_directory" example is "/media/backup" in your case.

I figured out that much ;-) thanks for the help!

Habitual 02-13-2014 05:26 PM

Is it now working?

Ryanms3030 02-13-2014 06:03 PM

Quote:

Originally Posted by Habitual (Post 5117194)
Is it now working?

I'm at work now so I don't have access to my server to test. I will report back once I am able to test

Habitual 02-13-2014 06:06 PM

sure thing!

Subscribed with interest....

Ryanms3030 02-13-2014 09:55 PM

Quote:

Originally Posted by Habitual (Post 5117148)
Plug the drive in (automount is ok if it does this)
and open terminal and type
Code:

mount | grep sd
or mount through disk management then "mount | grep sd"

show us the output.

John

When I run this command I get:

Code:

/dev/sdc1 on /boot type ext4 (rw)
I have 2 usb drives connected and I am guessing sdc1 is the internal boot drive on the computer.

When I :
Code:

lsusb
it returns:

Code:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 005: ID 152d:2329 JMicron Technology Corp. / JMicron USA Technology Corp. JM20329 SATA Bridge
Bus 002 Device 006: ID 1058:0704 Western Digital Technologies, Inc. Passport External HDD

I know the last two devices are the usb drives. Can I mount them with any of that info?

Tadaen 02-13-2014 10:44 PM

Code:

lsblk
ls -l /dev/disk/by-uuid

would be more appropriate. it will tell you everything plugged in and its /dev/locations. if they aren't mounting automatically then /etc/fstab is the way to go. do it by uuid though, just today i restarted my computer and my flash drive and usb hdd swapped /dev locations. uuid that can't happen.


All times are GMT -5. The time now is 08:27 AM.