Continuing the discussion from [miniDLNA starts indexing files then suddenly stops]

Continuing the discussion from miniDLNA starts indexing files then suddenly stops:

Had to warn some problems with this solution, if you have HDD Idle package, this solution may crash you're router after the HDD spins down, so you have to disable this function.

Someone on the old threat asked me about the benefits of binding this directorys at startup and its that whatever package you may install on you're router after this, it will install on the ext3 partition so it will not use the router flash chip space (this may be a solution for routers that the firmware almost use the entire space of the flash chip provoking that every time the router reboots it looses the config, amnesia problems).

I made some slight changes to the startup script, first for unknown reason even with the spin down option disabled, the ntfs disappears, so I had to make this changes.

First create a script on something like /etc/ntfsdetect with this:

#!/bin/sh

if [ -f /mnt/sda1/.optware.enable ]; then
  echo Already mounted
  exit 0
else
  if [ !/dev/sda1 ]; then
    if [ -d /mnt/sda1 ]; then
      ntfs-3g /dev/sda1 /mnt/sda1 -o rw,lazytime,noatime,big_writes
    else
      mkdir /mnt/sda1
      ntfs-3g /dev/sda1 /mnt/sda1 -o rw,lazytime,noatime,big_writes
    fi
  else
    echo Nothing to mount
    exit 0
  fi
fi

Then:

chmod +x /etc/ntfsdetect

Create a cron job with this script (mine is every 1 hour).

Finally, now the local startup should look something like this:

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/etc/ntfsdetect

if [ -f /mnt/sda2/.optware.enable ]; then
 mount -o bind /mnt/sda2/etc /etc
 mount -o bind /mnt/sda2/bin /bin
 mount -o bind /mnt/sda2/lib /lib
 mount -o bind /mnt/sda2/usr /usr
 sleep 2
else
 exit
fi

exit 0