Work has been more about tearing down and transitioning lately. Been busy and my domain and work responsibilities are shifting. In IT, this happens all the time. Flexibility, desire to learn, and being open to this type of change are the keys to survive in technology related fields.
Using rsync to Mirror Data to a Different Server
Like many things on this blog, I don’t use this enough to remember the full command when I need it. Like always, don’t just copy and paste this information. Use the man pages to verify what it is that you need to do.
rsync -a -v --delete --update --stats /path/to/local/data/ user@<server-name>:/path/to/folder/
This version of the command essentially maintains ownership and permissions while allowing for file changes, including file deletions, to be copied from the local server to another server. It mirrors the data on the local server to a second server. It also provides a listing of statistics when the command has completed.
A similar command using robocopy on MS systems was posted at an earlier date and can be found here:
Accessing a Windows Share from the Native Windows Command Prompt
I needed to run a application installer from a share located on a server. I knew I could use “net use” to map the drive but I remembered that there was an easier way but couldn’t recall the command. After some searching I found it:
pushd \\<server>\<share>
Then after you are done accessing the share:
popd
Per the docs, pushd will start at the drive letter “Z” and work its way back until the next unused drive letter is found and use that letter for the mapping.
As a “net use” refresher to map a drive:
net use z: \\<server>\<share>
Of course there are other switches available so to get help:
net use /?
And since “net use” is part of the “net” command:
net /?