Need to clone a folder structure to a dev VM
My question is: If have a centos machine in a VM, how can I clone a directory, including symbolic links abd files to it, from the node via ssh?
I need to match this so I can get the site running in non-production, so I can make changes to it.
Background:
I'm not a linux guru by any means, and I'm fighting through this.
My friend's business has a site, created in 2014, hosted on linode and I'm trying to setup a development environment for them. The old developer is gone. I have the root password, which has enabled me to get almost everything; but recreating the environment has proven beyond my experience.
The website uses a folder structure filled with symbolic links. There are a lot of them, pointing all over the place. It looks like the old developer had a tool that built it programmatically.
I tried using tar to archive the folder, but I've learned that it doesn't recreate the folder structure exactly. The links don't get recreated.
I've built a centos VM and almost have everything matching.
Is there a way to have a folder structure, including files and links, mirrored to another machine? A utility or a tool?
Any advice would be very appreciated.
Thank you.
3 Replies
It's been awhile since I played with Redhat-derived distros, but you might try using zip with the --symlinks flag. E.g.
zip --recurse-paths --symlinks archive.zip target-directory
or
zip -ry archive.zip target-directory
Then copy the zip file to your dev machine and unzip it.
You could use a tool like rsync to sync directories between the Linodes, or you could also just clone the disk from the old one to the development Linode. From there you can copy any files/directories as neceesary. Depending on sizes, you might need to resize a disk first to make everything fit.
It sounds like you've already put a lot of work into it so you might not want to go this route, but you can clone the entire Linode as well to get a 1:1 copy.
Keep in mind that any configurations that get copied are going to be maintained to the new Linode, so anywhere that the IP or FQDN is hard-coded in might need to be changed.
I had limited success with Rsync - I used the switches -avuL (to try and avoid re-downloading everything).
I'll try the zip option.
If I can get everything setup correctly, I'm hoping to just get the site running.
Worst case scenario, I'll go the clone route.
Thanks for your help.