Server backup with HubiC


hubicWell, I just ordered a HubiC 10TB plan so I must try to utilize it so that I did not waste my money :-). Hubic is a cloud storage service which provides 10TB for 5€ monthly. In this tutorial I will summarize the methods to do Linux server backup with HubiC. This will assume that you are using CentOS 6.5.

  1. First, we need to install dependencies

    [bash]yum install gcc make fuse-devel curl-devel libxml2-devel openssl-devel json-c-devel[/bash]

  2. Then, download and install HubiCFUSE:

    [bash]https://github.com/TurboGit/hubicfuse/archive/master.zip
    unzip master.zip
    cd hubicfuse-master
    [/bash]

  3. Install and configure it (be noted to add the export statement to avoid the error ‘Unable to find libjson. Please make sure library and header files are installed.’):

    [bash]export PKG_CONFIG_PATH=/lib64/pkgconfig/
    ./configure
    make
    make install[/bash]

  4. Create a new apps in HubiC Developer web interface. Be sure to use http://localhost/ for Redirection domain.
  5. Generate Token by running hubic_token inside the downloaded directory

    [bash]./hubic_token
    client_id (the app’s id): api_hubic_YOUR_APPS_API
    client_secret (the app’s secret): YOUR_APPS_CLIENT_SECRECT
    redirect_uri (declared at app’s creation): https://localhost/

    For the scope -what you authorize your app to do-, enter characters as suggested
    in parenthesis, or just hit return if you don’t need the item authorized.
    Get account usage (r): r
    Get all published links in one call (r): r
    Get OpenStack credentials, eg. access to your files (r): r
    Send activation email (w): w
    Add new/Get/Delete published link (wrd): wrd

    user_login (the e-mail you used to subscribe): [email protected]
    user_pwd (your hubiC’s main password):

    Success!

    # Here is what your app needs to connect to hubiC:
    client_id=api_hubic_YOUR_APPS_API
    client_secret=YOUR_APPS_CLIENT_SECRECT
    refresh_token=YOUR_NEW_GENERATED_TOKEN_PASTE_IT_TO_$HOME/.hubicfuse[/bash]

  6. Paste client_id, client_secrect, refresh_token to your $HOME/.hubicfuse file
  7. Mount hubic to your server:

    [bash]mkdir /mnt/hubic
    hubicfuse /mnt/hubic -o noauto_cache,sync_read,allow_other[/bash]

  8. Add the mount point to /etc/fstab:

    [bash]hubicfuse /mnt/hubic fuse user,noauto 0 0[/bash]

  9. Run rsync with –no-times directive to avoid “failed to set times” error:

    [bash]rsync -uptorgvlHaz /home/ /mnt/hubic/backup/home –no-times[/bash]

  10. Finally, set your crontab to run the rsync for a specific period and you are done 🙂

TroubleShooting

  1. If you face the error of connection “cannot access /mnt/hubic: Transport endpoint is not connected”, just unmount and remount the hubic

    [bash]umount -l /mnt/hubic
    hubicfuse /mnt/hubic -o noauto_cache,sync_read,allow_other[/bash]


About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

Your email address will not be published. Required fields are marked *