HOw to restore some specifics folder from back up in droplet?

April 19, 2018 221 views
Apache Ubuntu 16.04

I am running a site with lots of images occupying around 80 GB space in my droplet,the thing is I am running my site with Server pilot but now I intend to run my site in Ngnix and set up the Nginx on my own newly.

I can restore the files from the back-up but I only want to restore some specifics folder containing the images and some other folders containing the file of my site,so is it possible to restore only some specifics folders without restoring all the files of my site cause I intend to newly install the Nginx and I don't want the files installed by the server pilot on my droplet.

Here is what I intend to do ;

i)Set up Nginx newly (I have already done this so I can this).

ii)Restore only some specifics folder and files from the back up.

The problem is with the second steps restoring only specific files and folders.Of course the other option is to download the files from the droplet and re-upload it manually again to the new droplet but my files size is 80Gb wonder how much time that will take.

Thank you,

1 Answer

You cannot copy only specific files from a backup image but you can either use the backup to create a new droplet or if the droplet you want to copy the files from still exists you can use SFTP to copy the files directly from the old server to the new. If you have private networking enabled the transfer shouldn't take more than a few minutes.

  • Transferring using the SFTP from the old droplet to the new droplet,can I perform this for only specifics folder? if yes any tutorial links on this will be grateful.

    Thank you for the reply.

    • Sure thing. Every droplet supports SFTP/scp transfers by default since this operates through the ssh server. You will need to make sure you can authenticate from one server to the other. If you are using a root password instead of ssh keys you can just use that.

      So, if the directory with your files is /var/www/myfiles on server1 and you want to copy those files to the same location on server2 you could log into server 2 and run:

      mkdir /var/www/myfiles;
      cd /var/www/myfiles;
      scp -r root@server1:/var/www/myfiles/* .

      The first line creates the "myfiles" folder on server1.

      The second line changes directory so your command will be run in the new folder.

      The third line copies all files recursively (that's the -r flag) from /var/www/myfiles on server1 to your current location on server2 (the directory we changed into with the last command).

      In the third line you will replace "server1" with that server's public (or if they have it enabled and are in the same region, private) ip address.

Have another answer? Share your knowledge.