TonidoPlug2 automatically creates /media folders problem

Support for your TonidoPlug
3wheels1life
Veteran Tonidoid
Veteran Tonidoid
Posts: 50
Joined: Thu Nov 14, 2013 2:02 pm

TonidoPlug2 automatically creates /media folders problem

Postby 3wheels1life » Tue Apr 08, 2014 2:52 pm

Hello,

I have a TP2 which is booted off a SATA drive.
Whenever I reboot the TP2 and/or its attached HDD's (externally powered), the TP2 automatically creates folders for the new drives.

I have three drives connected: an 8gb usb stick, a 500gb USB drive, and a 1tb USB drive (soon to have two more external disks!).

Anyway, I have three directories in /media that I'd like to use for my drives.
Indexing, user data directory, sync, applications, and other features require to be setup for a specific folder/device.

I want the drives to be mounted as /media/disk1part1 (the 8gb), /media/disk2part1 (the 1tb), and /media/disk3part1 (the 500gb). Others would be added in numeric order.

The problem is, when I reboot the TonidoPlug2 either manually or using Admin, the devices aren't automatically mounted to these directories (mentioned above in bold). Instead, new directories are automatically created, eg. /media/disk12part1, when there aren't even 12 disks attached (only 3).

Every time, when I want to setup the directories how I want them, I must run a number of commands (fdisk -l, umount, mount, df -h). Though it only takes a few minutes, I'd like a better solution to have the devices mounted.

My question is this: How can I setup the TP2 to automatically mount each disk on a specific (already set up) directory on boot or when the drives are detected?

Thank you.

-3wheels1life

Also (not related): I noticed the TonidoShell application that runs in the browser won't let me run apt-get or speedtest-cli without crashing the TP2 (making it unresponsive via Tonidoid.com). These functions worked fine over SSH from the LAN.

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: TonidoPlug2 automatically creates /media folders problem

Postby madhan » Wed Apr 09, 2014 11:54 pm

TP2 is supposed to keep mounting the same drives back to the same paths automatically without creating these different paths.

The fact it is not doing that means that the enumeration of the drives and the detection of the drives by the plug is changing every single time you boot causing the folder paths to change where the drives are mounted.

How are the USB disks connected? Via a USB hub? If you have a single drive connected without the hub does it work OK?

3wheels1life
Veteran Tonidoid
Veteran Tonidoid
Posts: 50
Joined: Thu Nov 14, 2013 2:02 pm

Re: TonidoPlug2 automatically creates /media folders problem

Postby 3wheels1life » Fri Apr 11, 2014 7:48 am

madhan,
The drives are connected via a USB hub. I haven't tested them without it. The hub is needed because I have multiple drives.

-3wheels1life

Tuxedo
Tonido Team
Tonido Team
Posts: 1458
Joined: Wed Jan 28, 2009 11:30 pm

Re: TonidoPlug2 automatically creates /media folders problem

Postby Tuxedo » Mon Apr 14, 2014 1:37 pm

Hello,
The drives are remembered using some unique id from the disk's filesystem.
Everytime you format the disk (even though it is the same disk), it creates a new id. Thats why your disk number kept growing.

Workaround for you to get it the way you like is to
1) Remove all the usb drives
2) SSH into the plug and remove this file
rm -f /root/app/tonido/plugscripts/disk.db*
3) Connect your 8gb disk first. Make sure it gets /media/disk1part1
4) Connect your 1tb next. Make sure it gets /media/disk2part1
5) Finally 500gb. Ensure /media/disk3part1 for that.
6) Now these paths wont change until you reformat any of these disks. (In which case you just need to reset the db again)

3wheels1life
Veteran Tonidoid
Veteran Tonidoid
Posts: 50
Joined: Thu Nov 14, 2013 2:02 pm

Re: TonidoPlug2 automatically creates /media folders problem

Postby 3wheels1life » Mon Apr 14, 2014 8:07 pm

Tuxedo,

I did the following, in order as listed below:

1.

Code: Select all

umount
all USB drives individually.
2.

Code: Select all

rm -f /root/app/tonido/plugscripts/disk.db*

3.

Code: Select all

rmdir /media/diskXpartY
for each folder in /media
4. Connect USB drives in order (8gb, 1tb, 500gb)
5.

Code: Select all

mount
(read output)

None of the drives were listed as the folders I wanted them mounted to.

Is there a way to manually edit disk.db* ?

-3wheels1life

Tuxedo
Tonido Team
Tonido Team
Posts: 1458
Joined: Wed Jan 28, 2009 11:30 pm

Re: TonidoPlug2 automatically creates /media folders problem

Postby Tuxedo » Mon Apr 14, 2014 11:31 pm

Hi,
Yes, you can edit the disk db.
It will have something like this.
DISK|1|||1500.3 GB
DISK|2|||320.1 GB

and you can edit the second column to change the folder names.
The # in the second column will be used as disk number in the path. for instance /media/devXpartY. Here X is the number from that file.
If you have any issues, you can PM me your plugs SSH info. I can try to connect and take a look at the issue.

3wheels1life
Veteran Tonidoid
Veteran Tonidoid
Posts: 50
Joined: Thu Nov 14, 2013 2:02 pm

Re: TonidoPlug2 automatically creates /media folders problem

Postby 3wheels1life » Tue Apr 15, 2014 11:11 am

I used SSH to access my TP2, and then ran the following command (output pasted below).
As you can see from the terminal output, there is no disk.db (this is after I ran the rm -f disk.db). How can I recreate the disk.db?
Thanks.

-3wheels1life

Code: Select all

root@TonidoPlug2:~/app/tonido/plugscripts# ls
addShare.sh           getDate.sh             manageTZ.sh
applypatch.sh         getDU.sh               manageUSBDrives.sh
automountsharer.sh    getHDDList.sh          mediaStreamControl.sh
baseSambaConfig.tmpl  getLogText.sh          normalize
changeDNS.sh          getMediaStreamInfo.sh  removeShare.sh
changeHostName.sh     getMountedInfo.sh      resetNetwork.sh
changePassword.sh     getNetworkInfo.sh      sambaShareControl.sh
checkDU.sh            getPartitions          setNetworkInfo.sh
checkPassword.sh      getPlugInfo.sh         tempMon.sh
cleanupSpace.sh       getShareInfo.sh        update
diskRegistry.sh       isDataDirMounted.sh    updateImage.sh
formatUSBDrives.sh    label.db               ushare.tmpl
geninterfaces.sh      label.db~              wireless
getCPUInfo.sh         ledcontrol.sh

User avatar
madhan
Admin Tonidoid
Admin Tonidoid
Posts: 8617
Joined: Tue Dec 30, 2008 12:13 am
Location: Austin, TX, USA
Contact:

Re: TonidoPlug2 automatically creates /media folders problem

Postby madhan » Tue Apr 15, 2014 11:37 pm

If you plugin in a USB disk it should create one I think.


Return to “TonidoPlug Support”

Who is online

Users browsing this forum: No registered users and 8 guests