So we have a bunch of src files that are old and out-dated and need to be moved to our new NAS storage. (I don't know why we are keeping them).
Has anybody done something similar to this?
Yes you can do this if you have a system where both the src files are accessible and the NAS. There are several ways to do this with a single command, but the tool rsync
is probably the best one to go with:
$ sudo rsync -avz src /mnt/NAS/
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-v, --verbose increase verbosity
-z, --compress compress file data during the transfer
So the -a
switch is actually a macro for a whole bunt of switches:
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D same as --devices --specials
You'll want to run this as root to preserve the permissions and ownerships of the files + directories. Also this particular root user will need access to the NAS. This is sometimes not setup by default so you may need the help of an admin if you're not the one.
Typically you'll want to do some upfront analysis on the directories in question to see if there are any symbolic links or fifo type files. These will require additional switches to rsync
so that it recreates them correctly in the target directory.
All is not lost if you can't directly mount the NAS on the same box where you have access to the src files. You can also rsync
over ssh
.
$ sudo rsync -avz src root@remoteserver:/mnt/NAS/.
There are more advanced options if neither of these suite your needs.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments