What's new

Replacing USB drive - best practice?

  • 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 have a related question. Already have a 16GB USB Flash Drive partitioned to Ext4 and 2GB swap file with just about all the little Script programs installed via amtm on the USB 3.0 port. The problem I have with the flash drive is it sticks out about 2.5 inches from the back side of my AC68U. afraid that over time that I might accidently break it off, damage it.

So I bought a 16GB short (about 3/8 inch long) USB Flash Drive and have it installed into the adjacent USB 2.0 port of my AC68U. What I want to do, as simply as possible, is to copy/diskcopy/clone (whatever you wanna call it) what's on the existing Flash Drive to the new shorter Flash Drive and then swap out the New one into the USB 3.0 port. Then either keep the old one for back up, or wipe it and use it for something else, or give it to a buddy of mine for his AC68U and let him break it off :D



Can I do this within a ssh session on the router? When I type in "rsync" at ssh command line I get [-sh: rsync: not found]. I'm guessing rsync isn't a recognized command in the router?

EDIT: I managed using amtm to format the new shorter USB drive with the "fd" command. Is there an equally easy way to diskcopy the contents of the original USB drive with the New USB drive to be swapped?



EDIT: just installed rsync using [opkg install rsync] just not certain of the proper syntax to do the diskcopy. :eek: Too many switches/parameters...

What is the syntax for the command line? I see both flash drives on the asuswrt-merlin GUI but I don't know how to see it at the command prompt in ssh session.

If not, then what is the best way to do this within windows 10.

TIA

I did this recently and used for my purposes:

Code:
cp /tmp/mnt/sda1/* /tmp/mnt/Samsung8GB/
 
I did this recently and used for my purposes:

Code:
cp /tmp/mnt/sda1/* /tmp/mnt/Samsung8GB/

where /tmp/mnt/sda1/* is the source and /tmp/mnt/Samsung8GB/ is the destination?

When I use the "df" command at the command prompt I see:
~
/dev/sda1 14651282 2180754 11689012 16% /tmp/mnt/AsusRTAC68U
~
/dev/sdb1 14779860 167912 13861152 1% /tmp/mnt/SanDiskuFit
~

where [/dev/sda1 14651282 2180754 11689012 16% /tmp/mnt/AsusRTAC68U] is the source drive
and [/dev/sdb1 14779860 167912 13861152 1% /tmp/mnt/SanDiskuFit] is the destination drive

so the proper syntax would be [cp /tmp/mnt/AsusRTAC68U/* /tmp/mnt/SanDiskuFit]?

UPDATE: I failed/didn't notice the trailing "/" after the Samsung8GB on your directions.
I don't know if it made a difference. the output showed this:

cp: omitting directory '/tmp/mnt/AsusRTAC68U/entware'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/lost+found'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/nsru'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/skynet'

dunno why it omitted those directories....
 
Last edited:
Can I do this within a ssh session on the router? When I type in "rsync" at ssh command line I get [-sh: rsync: not found]. I'm guessing rsync isn't a recognized command in the router?

Rsync isn't included in the firmware. Use cp instead.

Code:
cp -a /mnt/oldusb/* /mnt/newusb/

If you want to use rsync through Entware:

Code:
rsync -a --del /mnt/oldusb/ /mnt/newusb

Note that this will delete everything on the newusb drive, as it basically turns the newusb into a mirror of the old one.
 
Rsync isn't included in the firmware. Use cp instead.

Code:
cp -a /mnt/oldusb/* /mnt/newusb/

I did this recently and used for my purposes:

Code:
cp /tmp/mnt/sda1/* /tmp/mnt/Samsung8GB/

I tried bluzfanmr1's method without the "-a" option and didn't include the last "/":

cp /tmp/mnt/AsusRTAC68U/* /tmp/mnt/SanDiskuFit I got this error:

cp: omitting directory '/tmp/mnt/AsusRTAC68U/entware'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/lost+found'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/nsru'
cp: omitting directory '/tmp/mnt/AsusRTAC68U/skynet'

Using your method, cp -a /tmp/mnt/AsusRTAC68U/* /tmp/mnt/SanDiskuFit/

After a few minutes, it went right back to command prompt no "omitting directory" errors.
 
Sorry about that, I forgot the -a with the command.
 
Sorry about that, I forgot the -a with the command.

No harm done, lots of cool stuff to learn here! :)

After starting amtm at the command prompt saw:

Swap file path corrected in
/jffs/scripts/post-mount

I imagine that this was because the old label from old drive "AsusRTAC68U" was replaced by new label of new drive "SanDiskuFit"? Thanx @RMerlin

UPDATE 05/03/2020:
I ended up just flashing a Fresh USB Drive to NTFS , In amtm "fd" formatting a new USB drive. "sw" creating a swap file and reinstalling most of the Scripts available in amtm. It is after all a fairly easy process, and at least for me, no important/critical configuration settings that had to be saved.

I was finding that 2 things were a bit buggy, when I tried to both "rsync and cp" an original USB drive to another. (maybe a USB Flash drive innate settings thing? There always seems to be some reserved space--a few MB's--on the USB drive reserved for something. So using two different manufacturers USB drives couldn't truly 100% accurately image them)

1) I noticed that my Overclocking of my 68U using @ironclad's method failed often at reboots and was buggy reverting to the default/original router clkfreq.
2) I noticed that at the command line within the router when I would type a command, the command would not be "remembered" simply by pressing the "Up" arrow in the keyboard.
2a) I think somehow item 1) and 2) are related since overclocking using @ironclad's method involved a script to be activated on the next reboot. [/jffs/scripts/services-stop]
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

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