FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14260 questions

16894 answers

27810 comments

54588 members

0 votes
203 views 5 comments
by

Hello,

for different reasons, I have to connect 2 different USB Storages ( 1 external HDD and 1 USB Stick) via a USB Hub to my RUTX14.

This works fine. Both are visible in the WebUI  and are accessible via SSH / putty  as /dev/sda1 and dev/sdb1 , mountet as / mnt/sda1  or /mnt/sdb1.

Unfortuantly, the assignment to  sda1 or sdb1  depends on the order the devices are connected. So one drive may appear as sda1 or sdb1.

This makes it difficult to access data via Samba or via a bash script.

Is the any way to fix the assignment?

Thanks for your support

2 Answers

0 votes
by

Hello,

As an alternative method, to define mount points, you could try the following:

First, get UUID of storage device by running the command:

  • block info

The example output is below:

/dev/mtdblock5: UUID="5385a573-46532cb1-817cdc87-d2c06207" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock6: MOUNT="/overlay" TYPE="jffs2"
/dev/mtdblock7: MOUNT="/log" TYPE="jffs2"
/dev/mmcblk0p1: UUID="ba13efc4-0ee1-4cab-b672-135d0b1bcb5e" LABEL="RUTOS_overlay" VERSION="1.0" 

SDcard is mounted at /mnt/mmcblk0p1 and UUID is ba13efc4-0ee1-4cab-b672-135d0b1bcb5e.

Now modify /etc/config/fstab file, add:

config 'mount'
        option target '/path/where/mount/is/needed'
        option uuid '<uuid>'
        option enabled '1'

For example:

config 'mount'
        option target '/mnt/test'
        option uuid 'ba13efc4-0ee1-4cab-b672-135d0b1bcb5e'
        option enabled '1'

Save this config, create /mnt/test path within the device and reboot the device. Before reboot it was mounted in /mnt/mmcblk0p1:

[email protected]:/mnt# df -hT | grep mmc
/dev/mmcblk0p1       ext2           14.2G     16.8M     13.5G   0% /mnt/mmcblk0p1

After reboot:

[email protected]:~# df -hT | grep mmc
/dev/mmcblk0p1       ext2           14.2G     16.8M     13.5G   0% /mnt/test

Best regards,

Best answer
by
Good description.
by
Thanks!

sorry for my late reply due to Christmas.  

Extremly helpful !

Martin
0 votes
by
Hello,

Do you have something in /dev/disk ? /dev/disk/by-id ?

Regards,
by

Unfortunatly not, even the directory /dev/disk doesn't exist. 

This is the content of my fstab:


[email protected]:/dev# cat /etc/fstab

# <file system> <mount point> <type> <options> <dump> <pass>

/dev/mtdblock15 /log            jffs2   defaults 0 0

by
Can you try the following commands:

echo p | fdisk /dev/sda

echo p | fdisk /dev/sdb

and check if you can see something different ? If so you can build manual mount commands with a known order.
by
That's a good idea!

Thant you for your idea!

There a differences that i can use to remount devices in the correct order!

I will try  this during the next days. This will also improve my very basic bash scripting skills ;-)