What is the most efficient way to migrate a website over SFTP without full SSH Access?

0

I need to migrate a reasonably large website to a new server for a client with the least amount of downtime as possible.

Unfortunately the client's current host only allows SFTP access without full access to SSH. I tried to mount the file over sshfs and use git to clone the site from there, but running git commands end up being prohibitively slow. The downtime required is unacceptable for the client.

Downloading the full site and then uploading is impractical as well since it takes hours.

I would use rsync, but as I understand it, rsync requires full access on the server in order to work properly.

Anyone have other suggestions?

knsheely

Posted 2018-10-05T21:58:36.553

Reputation: 1

'Downloading the full site and then uploading is impractical as well since it takes hours.' -- So you're saying the client doesn't have a backup of their site? That's worrying. – djsmiley2k TMW – 2018-10-05T22:04:10.290

1They did not, but I don't think that is really relevant to the topic. The upload of the backup would still take hours. – knsheely – 2018-10-06T19:46:46.080

Answers

0

I was able to use rsync locally by mounting the filesystem to a local directory on the new server using sshfs, then running rsync to another directory. The initial sync is a little slow, but once it was synced once, the subsequent sync that I ran during the downtime was sufficiently fast.

Make sure fuse is installed and run:

sshfs [user@]hostname:[directory] intermediate-directory

Then use rsync to sync to the final directory.

rsync -azP --delete intermediate-directory/ final-directory

The first time you run rsync it will have to download everything, so expect this to take quite some time. As long as you are not using checksums or doing anything that requires rsync to download entire files, the next sync will be much quicker since it will only download changed files. I recommend running the command once right before you are ready to take the site down, then it will guarantee to have the most up to date files. Then run it again immediately after.

knsheely

Posted 2018-10-05T21:58:36.553

Reputation: 1