What's new

Direct copy from N66U(USB) to NAS

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

I am trying to figure out a similar script for my rtn66u but to copy one attached usb drive to another on a daily basis. Both drives are ntfs formated for compatability reasons... I think I first need to make sure that the script first mounts my drives according to their uid's...basically I have two ysb enclosures with raid0 and I would like to mirror one to the other every night....any help with this will be greatly apreciated...

Please give more details, are both drives connected to router through usb ports or only one?
 
Correct, I have two usb enclosures connected to two usb ports on the router...please let me know what details are needed and I will provide. I curently have two 1TB drives in one of the enclosures running in raid1. I am hopping to change it to Raid0 to get 2TB and have this enclosure mirrored to another enclosure with the same setup...pleae let me know of the best way to acomplish thus...I may need to create/enable swap space for something as memory intensive as rsync...
 
Correct, I have two usb enclosures connected to two usb ports on the router...please let me know what details are needed and I will provide. I curently have two 1TB drives in one of the enclosures running in raid1. I am hopping to change it to Raid0 to get 2TB and have this enclosure mirrored to another enclosure with the same setup...pleae let me know of the best way to acomplish thus...I may need to create/enable swap space for something as memory intensive as rsync...

Post "mount" output
 
Here is my mount output...


rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw)
devfs on /dev type tmpfs (rw,noatime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sdc1 on /tmp/mnt/MEDIA type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,sparse,force)
/dev/sda1 on /tmp/mnt/CACHE type ufsd (rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,sparse,force)
 
The Media drive is the 1TB storage in Raid1 and Cache is the same type of enclosure but currently with a small drive..I will soon upgrade it to 2TB (Raid0) as well...
 
First we need to create a pre-mount script (i'm not 100% sure, maybe init-start script, will see after testing)
Code:
#!/bin/sh

mount -t nfsd -o rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force UUID="EA1E40681E402FBD" /tmp/mnt/MEDIA
mount -t nfsd -o rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force UUID="6C806B1E806AEDD0" /tmp/mnt/CACHE
Code:
chmod a+rx /jffs/scripts/pre-mount
Reboot router 2-3 times to see if are mounted as we need, check with "mount" command
 
If is ok, create the following sync-drives.sh script in /jffs/scripts, this will copy all files from CACHE to MEDIA
Code:
#!/bin/sh

rsync -r -l -t -p -g -o -D -h -s /mnt/CACHE/* /mnt/MEDIA
Code:
chmod a+rx /jffs/scripts/sync-drives.sh
If you want to run the script automaticaly every day at 21:00, add this cron job to init-start script
Code:
#!/bin/sh

cru a sync-drives * 21 * * * /jffs/scripts/sync-drives.sh
Code:
chmod a+rx /jffs/scripts/init-start
Code:
reboot
 
First we need to create a pre-mount script (i'm not 100% sure, maybe init-start script, will see after testing)
Code:
#!/bin/sh

mount -t nfsd -o rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force UUID="EA1E40681E402FBD" /tmp/mnt/MEDIA
mount -t nfsd -o rw,nodev,noatime,nls=utf8,fmask=0,dmask=0,force UUID="6C806B1E806AEDD0" /tmp/mnt/CACHE
Code:
chmod a+rx /jffs/scripts/pre-mount
Reboot router 2-3 times to see if are mounted as we need, check with "mount" command

I guess this script is better, just in case http://forums.smallnetbuilder.com/showpost.php?p=59842&postcount=5
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top