Howto: Get Network Drive Indexed

Howto: Get Network Drive Indexed

Postby premiso » 28 Nov 2010, 12:02

Still not working
Upon further testing it seems that the C: symoblic link is still getting put on the USB drive upon reboot. I have no clue why this happens or how to prevent it, until that gets figured out the below does not work and should not be integrated. I will be working on it and update you as soon as I get it figured out.

The fix for now, if you want to continue, is once a reboot occurs, you need to wait till the device starts to index, Power off the ASUS with the remote, telnet into the ASUS cd to /tmp/usbmounts/sd_1/ and do a rm -f C: then power back on the ASUS and it should run fine, I leave telnet open and cd back to the /tmp/usbmounts/sd_1 to verify that the C: file is gone, if it is not I do a rm -f C: and then power off with the remote and then back on and it should work.

Howto: Get Network Drive Indexed
So tonight I have been playing quite a bit with the O!Play (HDP-R1 - HD2) in an effort to get my network drive(s) indexed and finally have achieved it. This process is a bit hackish, so user beware, I am not responsible for any type of bricking this may cause, so follow this guide AT YOUR OWN RISK.

I have tested this process very thoroughly, a few tidbits before we begin. If at some point you get stuck at the initial ASUS white logo for longer then 2 minutes, Hold the power button on the remote for 5 seconds and pray. This worked for me 3 different times, but this was also due to improper order of operations inside the rcS file. If you follow this guide, this should not happen, but no guarantees.

Requirements
USB Stick (1-2 GB) formatted for *nix (I did ext3 using gparted using a Debian based laptop)

The USB Stick will need to be plugged in anytime you want your networked media to be indexed. It will also require a file to be on it and remain on the drive. I would pick up a cheap $7 stick for this, if you have an external USB drive you want to continue using, then this tutorial is probably not for you as that USB slot will need to stay occupied anytime you want your network drive indexed (if you do not care to index it, again this tutorial is not for you).

Start the Process
First things first, format your USB thumb drive to ext3, this will not work with windows file systems as it requires a *nix specific functionality (symbolic links). So backup anything on the drive then format it, not backing it up will make you lose all the data currently on the drive. I used gparted under Debian for this process.

Once the USB Drive has been wiped and formatted to ext3, we need to telnet into the ASUS box:
telnet ipaddress

Once inside the telnet execute:
cd /usr/local/etc/

Once here we will need to create a file, I did not write this script, I give credit where it is due this came from the ASUS forums CCIECanuck found here. This solved an issue I was having with some infinite looping earlier.

mkdir script

vi script/amnt.sh

copy the following code and paste it into the telnet vi session, You can modify the variables below, if you want to (not recommended).
Code: Select all
#!/bin/sh

##Global variables
MOUNT_POINT_ROOT=/usr/local/etc/mnt
LINKS_DIR=/tmp/ramfs/volumes
NFS_CONF="/usr/local/etc/script/nfs.conf"
SMB_CONF=/usr/local/etc/script/smb.conf

#These are standard mounting options for samba #(They change be changed) type "mount -h for some #-o options"
SMBOPT='mount -t cifs -o'

## These are the standard options for NFS (They can be changed)
NFSOPT="mount -t nfs -o ro,nfsvers=3,port=2049,intr,timeo=60,rsize=16384,wsize=16384,hard,udp,nolock"

if [ -f "$NFS_CONF" ]; then  #Check for a NFS Config                                                                                 

##
cat "$NFS_CONF" | while read NFS_PNT NFS_SHARE #Read the NFS Config
do


MOUNT_POINT_NFS="$MOUNT_POINT_ROOT/$NFS_PNT" #Set The NFS Mount Point
##

##

df -h | grep "$MOUNT_POINT_NFS" >/dev/null 2>&1 #Check to see if its already mounted
if [ $? -eq 0 ]; then
umount $MOUNT_POINT_NFS
fi

if [ -d $LINKS_DIR/$NFS_PNT ]; then #Check for the SymLink and delete it if there is
rm -rf $LINKS_DIR/$NFS_PNT
fi

if [ ! -d "$MOUNT_POINT_NFS" ]; then #Create the Dirctory Strcuture if it does not exist
mkdir -p $MOUNT_POINT_NFS

elif [ $? -eq 0 ]; then     
echo "making $MOUNT_POINT_NFS failed"

elif [ -d "$MOUNT_POINT_NFS" ]; then
# mount the file server
echo "Running Command: $NFSOPT $NFS_SHARE $MOUNT_POINT_NFS"
$NFSOPT $NFS_SHARE $MOUNT_POINT_NFS #Mount the NFS Share
fi

df -h | grep "$MOUNT_POINT_NFS" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "We Failed to Mount the NFS Share: $NFS_SHARE "
else
ln -s $MOUNT_POINT_NFS $LINKS_DIR/$NFS_PNT #Create the Symlink So it will show as a storage Device
echo "Successfully Mounted NFS Share: $NFS_SHARE "
 fi 
##
done
fi

if [ -f "$SMB_CONF" ]; then #Check for a Samba Config

##
cat "$SMB_CONF"  | while read SMB_PNT UNAME PASS SMB_SHARE

do

MOUNT_POINT_SMB="$MOUNT_POINT_ROOT/$SMB_PNT" #Set the Samba Mount Point

##
df -h | grep "$SMB_PNT" >/dev/null 2>&1 #Check to see if its already mounted                                                                         
if [ $? -eq 0 ]; then
echo "NFS Mounted Already"
else

if [ -d $LINKS_DIR/$SMB_PNT ]; then #Check for the SymLink and delete it if there is
rm -rf $LINKS_DIR/$SMB_PNT
fi
                           
if [ ! -d "$MOUNT_POINT_SMB" ]; then #Create the Dirctory Strcuture if it does not exist
mkdir -p $MOUNT_POINT_SMB

elif [ $? -eq 0 ]; then
echo "making $MOUNT_POINT_SMB failed"

elif [ -d "$MOUNT_POINT_SMB" ]; then
# mount the file server
echo "Running Command: mount $SMBOPT username="$UNAME",password="$PASS" $SMBSHARE $MOUNT_POINT_SMB"                                                             
$SMBOPT ro,username="$UNAME",password="$PASS" $SMB_SHARE $MOUNT_POINT_SMB
fi

df -h | grep "$MOUNT_POINT_SMB" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "We Failed to Mount the SMB Share: $SMB_SHARE "
else
ln -s $MOUNT_POINT_SMB $LINKS_DIR/$SMB_PNT #Create the Symlink So it will show as a storage Device
echo "Successfully Mounted NFS Share: $SMB_SHARE "
 fi
fi
##
done

else                                                                                                 
echo "No Valid Samba or NFS Configurations Exsist"                                                   
exit 1                                                                     
fi


Here are the smb.conf files and nfs.conf files, make them inside the scripts dir as well, these are example scripts, you do not have to use both, use the one that suits your setup, the 1.1.1.1 should be the servers ip, mountdir is the name you want it to be mounted under (remember that name) the rest should be self explanatory I hope.

vi script/nfs.conf

##NFS Example Conf File
Code: Select all
mountdir 1.1.1.1:/nfsmount/point


vi script/smb.conf
##SMB Example Config file
Code: Select all
mountdir username pass //1.1.1.1/mountpoint


Once those (or your preferred method) have been created we need to make a network.sh file:

vi script/network.sh
Code: Select all
/sbin/ifconfig eth0 down
/sbin/ifconfig eth0 up 192.168.x.x # change this to be the static ip you wish your O!Play to have
sleep 2


Now to chmod the scripts for execution:
chmod +x script/network.sh script/amnt.sh

Now that we have the prelims setup, it is time to edit the rcS.

vi rcS

Scroll down to the end of the file add these 4 lines above the echo 2 line like below:
Code: Select all
. /usr/local/etc/script/network.sh                                                                       
sleep 5                                                                                           
. /usr/local/etc/script/amnt.sh                                                                                                                                       
sleep 2                                                                                           
                                                                   
echo 2 /tmp/hdd/volumes/HDD1/ > /sys/realtek_boards/misc_operations
/usr/sbin/initsys


What this will do is make sure that the network is up before attempting to mount your network shares, this should also process before the USB drive is located so the scan should work.

Now for the final step:
Plug the USB drive we formatted for this process into the O!Play, while still telnet into the machine cd to the usbdrive:
cd /tmp/usbmounts/sda1/
(Note sda1 could be something else if that does not work do a ls /tmp/usbmounts and use the sd_1 it displays)

Once there type the following command (remember to replace the mountdir name with what you put in the nsf.conf or smb.conf above):
ln -s /tmp/ramfs/volumes/mountdir mountdir

Finally we just need to reboot, so type reboot and cross your fingers.

If all went well
If all went well, the ASUS Should boot up, recognize the USB Drive and index it. The indexing can take some time, so be forewarned, this is normal, especially if you have a lot of data on your NAS share, this will happen anytime the USB Drive is unplugged or the system is restarted, unfortunately. When you click on "Movies" you should get a full list as you would if your data was on a plugged in USB Drive. If you do not like that list, you can still browse it just fine using the File Manager or the "Goto Folder" option. To use that just goto USB -> mountdrive and viola you have access to all those files.

Using this method will speed up as you do not have to login to the NAS each time and you only have to do 3 clicks instead of 5+

Hope it worked!
I am posting this here because I feel people may want this feature. It is not for everyone. If you have anything to improve this I am all ears! If you need help I will do my best if you want to post questions here, I am not an expert I just merely get by with trial and error. Again I am not responsible for what may happen to your system from trying the above instructions. I assure you I have this working on my HDP-R1 HD2 (11.03beta) ASUS O!Play and it works exactly how I described.
Last edited by premiso on 28 Nov 2010, 12:54, edited 2 times in total.
premiso
 
Posts: 14
Joined: 28 Nov 2010, 00:16

Re: Howto: Get Network Drive Indexed

Postby premiso » 28 Nov 2010, 12:27

Stupid thing.

Well apparently it keeps creating a C: symbolic link upon reboot on the USB drive, this causes an infinite loop for the index and eventually restarts the ASUS Box, I am working on fixing this, so please hold off on the above until it can be figured out!
premiso
 
Posts: 14
Joined: 28 Nov 2010, 00:16

Re: Howto: Get Network Drive Indexed

Postby Olegin » 28 Nov 2010, 15:12

To premiso: Try new FW 1.12.04b, it seems for me, that your troubles is fixed in it.
Asus O!Play R1 (amp, vrt), xTreamer Pro (amp, vrt), Iconbit 7L(amp, vrt), Iconbit 12L(amp, vrt/12l), Iconbit 1003(3Dgui)
Olegin
 
Posts: 1243
Joined: 04 Sep 2010, 20:13
Location: Ufa, Russia

Re: Howto: Get Network Drive Indexed

Postby premiso » 28 Nov 2010, 19:59

Olegin wrote:To premiso: Try new FW 1.12.04b, it seems for me, that your troubles is fixed in it.


Will do, if that is so I will be sort of happy and disappointed at the same time :) Stayed up to 3am figuring this out. Thanks for the heads up!
premiso
 
Posts: 14
Joined: 28 Nov 2010, 00:16


Return to About Asus O!Play

Who is online

Users browsing this forum: No registered users and 11 guests

cron