Can't access my USB HDD

4 5310
I can't access my USB HDD. I installed usbmount, etc. So how can i auto mount all of my external drives? Any idea? Thx!
Reply 1# bitmill

I'm not sure about usbmount, but it's fairly straightforward without it.  I have a banana pi & two usb external drives attached shared on samba and nfs.

Firstly you have to find out the unique identities of the drives by running
  1. sudo blkid
Copy the Code
It'll give you some results like this:
  1. /dev/mmcblk0p1: SEC_TYPE="msdos" UUID="D006-BFCA" TYPE="vfat"
  2. /dev/mmcblk0p2: UUID="ca07cb7e-26b6-4d91-b980-6f966c57b45b" TYPE="ext4"
  3. /dev/sda1: UUID="a1577b0e-e1d0-4fc6-af5b-794a7b6c20c0" TYPE="ext4"
  4. /dev/sdb1: UUID="dc0f3682-a961-40ba-b67d-71de22cc720e" TYPE="ext4"
Copy the Code
what you want are the two sda1 & sdb1 drive id's, and just edit your fstab file:
  1. sudo nano /etc/fstab
Copy the Code
and then add the following two lines to it, obviously changing the guids to your results.
  1. UUID=a1577b0e-e1d0-4fc6-af5b-794a7b6c20c0 /media/mydisklocation1 ext4 defaults 0 0
  2. UUID=dc0f3682-a961-40ba-b67d-71de22cc720e /media/mydisklocation2 ext4 defaults 0 0
Copy the Code
That's if they're formatted to Ext4 as in my case.  If they're not, fat32 or ntfs maybe, then you just have to change the mount options.  I used to have that, but ntfs isn't really supported as well as the native linux formats, and as such, the driver(s) are not as efficient, and can consume plenty of cpu.

You'll need to create the two directories that you would like them to be mounted to:
  1. sudo mkdir /media/mydisklocation1
Copy the Code
  1. sudo mkdir /media/mydisklocation2
Copy the Code
Then you can either reboot, or
  1. sudo mount -a
Copy the Code
which should mount the items

If they're ext2/3/4 format, you may want to think about permissions once they're mounted if they're to be read or written to by anyone or specific user(s), that's the chmod command.
Personally I tend to chmod them 777 (anyone can do anything), but it's bad practise really especially in a multi-user scenario!
  1. sudo chmod 777 /media/mydisklocation1
Copy the Code

Reply 2# markodeablo

It worked like a charm, thank you!!!
But what I exactly want is automatic mount /unmount my drives.

Reply 2# markodeablo

Good instruction!

Post Last Edited by bitmill at 2014-9-25 07:20

I found the solution:

1. apt-get install ntfs-3g (necessary for NTFS formatted drives)
2. apt-get install usbmount
3. edit usbmount.conf on /etc/usbmount with the following parameters:
    FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus ntfs"

Optionally reduce mounting points:
    MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2"

After that, automatically mounting / unmounting work well.

You have to log in before you can reply Login | Sign Up

Points Rules