What's new

Solved Replacing USB (Contains Entware) - Safest & Most Efficient Way?

  • 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!

Maybe I’m missing something here but if all you need is to clone your USB drive, and you are ‘fluent in Windows’, what is stopping folks just cloning the USB drive in Windows?

Doing a quick google search suggests there are Freeware programs out there for doing this and they handle ext4. Is there something that would prevent this achieving what I understood the OP asked about?

example (no affiliation whatsoever) https://en.taiwebs.com/windows/download-usb-drive-clone-pro-7160.html

There are even Programs that clone USB to SSD, whether they support ext4, I am not sure.
Those Windows programs aren't that mainstream, so just getting them to work properly maybe a bit of a challenge. Also, you still need to format to ext4 on router itself given that it's finicky about different ext4 options.

It just can take long to debug the Windows option - but if that works, more power to the operator!
 
In most cases you don't want to clone (i.e. make a bit for bit copy) one drive to another because they have different capacities. If that were the case you could use dd or many other methods. Recreating the filesystem and copying the files allows you to optimise, or even change, the filesystem layout. It also avoids the problem of copying over a corrupted filesystem.
Thanks Colin, ok, fair enough, if that’s what you want to do; I understood the request to be a simple backup prior to failure, not as a result of it, so a clone made sense.
But like you said, there are plenty of other ways of doing that but in my experience the only way to guarantee compatibility with the router is to make the filesystem using the router's own commands. You can then copy the files using any method you like, either on the router or on a PC. I've tried various Windows tools in the past and in the majority of cases they had one problem or another (especially with ext4), but YMMV.
OK, that also makes sense, although if a clone works (and I have not personally tried it) surely it has to be the easiest way, for primarily Windows users. IIRC I formatted my ext4 USB, on which I run Diversion Lite (only) in Windows, but it’s a few years back now so I cannot recall what I used. Possibly Minitool Partition Wizard; Paragon Partition Manager is another option, both freeware.
For the purposes of these forums we can't assume the user has access to a PC running Windows, Linux, macOS, etc. and an appropriate utility.
He did say he was Windows fluent, hence my suggestion.
If you can recommend some Windows utilities that have worked for you then that would be helpful. Not everyone is comfortable using a fairly clunky command line method.
See above; and I agree, given this is likely a one off exercise, if folks are not comfortable with command line or router-issued commands, then an alternative option in an OS they are more comfortable with may be all they need, in this instance.

k.
 
Last edited:
Those Windows programs aren't that mainstream, so just getting them to work properly maybe a bit of a challenge.
Personally, I would say Mini Tool Partition Manager is reasonably mainstream.
Also, you still need to format to ext4 on router itself given that it's finicky about different ext4 options.
ok, got me there, this would be a good reason to use the Router.
It just can take long to debug the Windows option - but if that works, more power to the operator!
True … but at least you’re able to navigate and do not have to learn how to use SSH, Putty, permissions, etc (all which I am reasonably comfortable with after using for quite a number of years now, but it can be daunting).

I am guessing though that the bigger picture here is if they have a formatted ext4 drive with scripts on it, they already know what they are doing ;-)
 
Thanks Colin, ok, fair enough, if that’s what you want to do; I understood the request to be a simple backup prior to failure, not as a result of it, so a clone made sense.
Yeah, in the OP's case he was wanting to copy the contents of a 16GB drive to a replacement 32GB drive. Most of the Windows utilities I've seen will clone partitions but can't resize ext4.
 
OK. As you currently only have a single partition (labelled ASUSUSB) I think I would take this approach.

1. Disable custom scripts and configs in the GUI and reboot the router.
2. Insert the new USB device and create a single partition using amtm with a different label (we'll change this later). The router will reboot.
3. SSH into the router and stop USB activity
Code:
service stop_nasapps
4. Copy the contents of the old drive to the new one:
Rich (BB code):
cp -a /tmp/mnt/ASUSUSB/* /tmp/mnt/new_drive_label
5. Do a df and make a note of the new drive's device name (e.g. /dev/sdb1).
6. Unmount both drives:
Code:
umount /dev/sda1
umount /dev/sdb1
7. Label the new drive:
Rich (BB code):
tune2fs -L ASUSUSB /dev/sdb1
8. Physically remove the old drive and reboot.
9. If everything looks OK re-enable custom scripts and configs in the GUI and reboot the router.

EDIT: Added final reboot step. Thanks @jksmurf ;)
Hi -- I have a couple further questions on this process. I am using an RT-AX88U so I do have 2 USB ports:

a). If I add the new drive into the second USB port (rear of the router), do I have to keep it there permanently? Or can I move it back to the port where the current USB stick is (front of the router)?

b). Since my new drive is larger than my original and way larger than needed for a swap file/Entware (128 GB), could I consider partitioning this to add a back-up share (say for BACKUPMON or otherwise)? Or is this not recommended?

Thanks...
 
a). If I add the new drive into the second USB port (rear of the router), do I have to keep it there permanently? Or can I move it back to the port where the current USB stick is (front of the router)?
You can move it to any port. That's the reason for ensuring the drive has a volume label, so that it's mount point is always the same regardless of the port it's plugged into or the order in which it is mounted.
 
You can move it to any port. That's the reason for ensuring the drive has a volume label, so that it's mount point is always the same regardless of the port it's plugged into or the order in which it is mounted.

Sometimes my single SSD USB glitches - a couple of times a year, and instead of /sda it comes in as /sdb. There is more to the glitch - the router does not work quite fully.

I usually try to check all USB connections there, since it should not be doing that.
 
That's precisely why you should label the drives, to avoid this being a problem for installed software that's looking for a specific mount point.
Yeah, mine are already labeled! Still - when my only USB drive becomes sdb, something else seems to be screwy.

Btw, I grepped sda on all my scripts, and found this in backupmon.sh (@Viktor Jaep):
Code:
backupmon.sh:EXTDRIVE="/tmp/mnt/$(nvram get usb_path_sda1_label)"            # Grabbing the default External USB Drive path
backupmon.sh:EXTLABEL="$(nvram get usb_path_sda1_label)"                     # Grabbing the default External USB Label name

I also check session I/O traffic in another script every 15 min, which does this:
Code:
echo "; sda1 wrote: $(echo "scale=2;$(cat /sys/fs/ext4/sda1/session_write_kbytes)/1024" | bc) MB"

Not sure how to do this by the label ...
 
Last edited:
Btw, I grepped sda on all my scripts, and found this in backupmon.sh (@Viktor Jaep):
Code:
backupmon.sh:EXTDRIVE="/tmp/mnt/$(nvram get usb_path_sda1_label)"            # Grabbing the default External USB Drive path
backupmon.sh:EXTLABEL="$(nvram get usb_path_sda1_label)"                     # Grabbing the default External USB Label name
This is just a first stab at getting what default storage is typically located at SDA1 when initializing these variables. However, @Martinski has added some great code that allows you to pick the right drive whether it's on sda or sdb (etc) from within the config menu.
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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