Forum

Full Version: Mount hard drives to a static location
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hey all,

i'm trying to mount my 2 external usb hard drives to a static location, but with no luck.
What i did was :

Code:
xbian@xbian ~ $ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Jan  1  1970 01CDE506D37447B0 -> ../../sda5
lrwxrwxrwx 1 root root 15 Jan  1  1970 29b6c2f5-5469-49f2-abd5-daa9149021cc -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Jan  1  1970 8B12-9112 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Jan  1  1970 CE3C43183C42FACB -> ../../sdb1

then checked :
Code:
xbian@xbian ~ $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/var/swapfile   swap    swap    defaults        0       0

and then :
Code:
sudo nano /etc/fstab
added these 2 lines :
Code:
UUID=01CDE506D37447B0 /media/usb0 vfat defaults,noatime 0 0
UUID=CE3C43183C42FACB /media/usb1 vfat defaults,noatime 0 0

but it doesn't seem to be working , does anyone know where i go wrong ?
Thanks !
- Keep in mind these drives have to be connected before boot

- Can you execute
Code:
sudo mount -a
and see if any errors pop up.

- This is also a nice guide: http://nwlinux.com/mount-hard-drives-in-etcfstab-using-uuid/
I am having the same issue.. I executed sudo mount -a before I started. Nothing came out. So good to get started. I first checked UUIDs and drive names (sda..):
Code:
xbian@xbian ~ $ sudo fdisk -l

Disk /dev/mmcblk0: 4025 MB, 4025483264 bytes
4 heads, 16 sectors/track, 122848 cylinders, total 7862272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f06a6

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       71679       34816    c  W95 FAT32 (LBA)
/dev/mmcblk0p2           71680     7862271     3895296   83  Linux

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9f41ab23

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    67110911    33554432    7  HPFS/NTFS/exFAT
/dev/sda2        67110912   976773167   454831128   83  Linux

xbian@xbian ~ $ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 15 Jan  1  1970 29b6c2f5-5469-49f2-abd5-daa9149021cc -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 10 Mar 24 16:17 433523ac-11c3-44a0-b9f6-ee30aaab2a03 -> ../../sda2
lrwxrwxrwx 1 root root 15 Jan  1  1970 8B12-9112 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Mar 24 16:16 8E37-FB11 -> ../../sda1
so the two partitions on my usbdrive are /dev/sda1 and /dev/sda2.

Now I edited fstab adding these two lines:
Code:
UUID=8E37-FB11 /media/SmallRyan  exfat defaults 0 0
UUID=433523ac-11c3-44a0-b9f6-ee30aaab2a03 /media/BigRyan ext4 defaults 0 0

and wrote it to the file. But now sudo mount -a gives me this error:
Code:
xbian@xbian ~ $ sudo mount -a
[sudo] password for xbian:
FUSE exfat 0.9.7
fuse: failed to access mountpoint /media/SmallRyan: No such file or directory
mount: mount point media/BigRyan does not exist

I followed the nwlinux.com guide.. but it didn't do the trick. What did I do wrong?


EDIT: I think I solved it, mounting harddisk/partition to "media/SmallRyan" means I first have to create such a folder!
So executed these two commands:
Code:
xbian@xbian ~ $ mkdir /media/SmallRyan
mkdir: cannot create directory `/media/SmallRyan': Permission denied
xbian@xbian ~ $ sudo mkdir /media/SmallRyan
xbian@xbian ~ $ sudo mkdir /media/BigRyan
xbian@xbian ~ $ sudo mount -a
FUSE exfat 0.9.7
xbian@xbian ~ $

So now it should work. I am not sure however if both Transmission, Flexget and XBMC have writing permissions..

EDIT: I thought this would do the trick but it doesnt:
Code:
xbian@xbian ~ $ sudo chmod -R 777 /media/SmallRyan
chmod: changing permissions of `/media/SmallRyan': Function not implemented
@coreflake
Try instead of using UUID to identify the disks, using "/dev/sda5" and "/dev/sdb1", if you always start the Raspy with the same drives connected it should work. To try it, just change it in the fstab file and execute the command "mount -a"
@zilexa
The error setting file permission is due to the file system of "SmallRyan", I recommend you change it to ext4, if it's not possible you must set permissions before mounting the drive. Add this options to fstab:
Code:
UUID=8E37-FB11 /media/SmallRyan  exfat defaults,uid=user,gid=group 0 0
[/term]
where user and group are the corresponding ones. You can also allow full access to by also adding umask=0.
I also recommend you add the option noatime (no access time) it speeds up the write/read speed and it's only necessary if you need the access time for your files (which isn't usual).
Trinket thanks for your help and tips. The reason I created one (small, 32GB) eXFat partition is for the theoretical situation that I want to connect my USB drive directly to my Mac or Win laptop because I need to transfer a big file and take it to a friend or somethin. Both dont support EXT4. Also, I can copy necessary files via XBMC File Manager to the eXFat partition and connect it to a Mac or Win pc.

It's just a safety measure I'd like to have. If I never use it and the EXT4 partition is filling up, I will delete the eXFAT partition and resize the EXT4 partition.
Just a follow up question about the best way to do static mount for an EXFAT partition:

@Trinkett did you mean I have to fill in an actual username and groupname?
Yep, I meant that! fill "user" and "group" with the ones you wish to grant access to! It can be either with the uid,gid (numbers) or just the name of them!
Reference URL's