Copying Drive Images from one Account to another

I would like to copy one of my drives to the cloudsigma account of a customer of mine – since I don’t wanna setup a new server if I don’t have to 😉

The default method for doing this, is by FTP. Now, the problem here is…

  1. it’s very slow
  2. the FTP connection may drop and this may result in an error (after I copied the drive by FTP, I received an  “invalid GPT header” Error with FreeBSD – it seems like the last bit’s haven’t been transferred.)

The best and fastest way is to use the Cloudsigma Scripts.

Download the Image Drive

Requirement: wget has to be installed.

Firstly install those Scripts on the customers Server:

mkdir /DRIVES
cd /DRIVES/
vi download.sh

paste the following (UUID_of_the_drive is the UUID of the drive you would like to download from your account):

#!/bin/bash
export WGETRC=/DRIVES/.wgetrc
wget api.zrh.cloudsigma.com:8880/UUID_of_the_drive

in order to hide the cleartext username and password in wget, I put this information into .wgetrc:

vi /DRIVES/.wgetrc

put:

http_user = CloudsigmaUsername
http_password = CloudsigmaPassword

Now make the file executable:

chmod 775 download.sh

I’m now connecting by VNC to the server in order to execute the download script. I do this by VNC, because I want to be able to shutdown my local PC if the download would take longer than expected.

/DRIVES/download.sh

Upload Image Drive

Requirement: CURL has to be installed.

Download Cloudsigma’s Drive Upload Script first.

cd /DRIVES/
wget http://cloudsigma.com/download/cs-upload.sh .
vi cs-upload.sh

Now, change the vars

CSURI=

and

CSAUTH=

as required (data of the account, where you would like to upload the image)

chmod 775 cs-upload.sh 

Now, connect again by VNC (the upload takes much longer than the download!) and start the upload:

/DRIVES/cs-upload.sh -n DriveName FILENAME

DriveName is simply the placeholder for the new name of the drive. If you don’t submit -n, the drive will be assigned basename of FILENAME.

The script now automatically splits the input file into 4MB chunks and transfers each chunk gzipped.

After the upload has succeeded, delete the DRIVES dir with all login and password details.

rm -rf /DRIVES/

Upload by FTP

This information is for reference only. Since the FTP transfer is too slow and data may get lost during the transfer.

$ lftp

lftp :~> set ftp:ssl-force yes
lftp :~> set ssl:verify-certificate no
lftp :~> connect ftp.cloudsigma.com lftp :~> login CloudsigmaUsername

Now download with get – and after download ftp to the other account and upload with put.

You can also transfer the file directly from one account to the other with the mirror command. But this is VERY slow. Even slower than downloading it first and then uploading it again.

lftp :~> login CloudsigmaSourceUsername
lftp :~> mirror /DRIVEIMAGES/ -i "^DriveName" ftp://CloudsigmaDestinationPassword@ftp.cloudsigma.com:21:/DRIVEIMAGES/

 

Flattr this!

  • Rob
    #1 written by Rob 4 years ago

    Danke!!! Genau danach hab ich gesucht. Das hat mir die Arbeit extrem verkürzt. Danke!

  • *

    You may use these HTML tags: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <s> <strike> <strong>

  • Comment Feed for this Post
Go to Top