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
    yum install gcc make fuse-devel curl-devel libxml2-devel openssl-devel json-c-devel
  2. Then, download and install HubiCFUSE:
    https://github.com/TurboGit/hubicfuse/archive/master.zip
    unzip master.zip
    cd hubicfuse-master
    
  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.’):
    export PKG_CONFIG_PATH=/lib64/pkgconfig/
    ./configure
    make
    make install
  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
    ./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
  6. Paste client_id, client_secrect, refresh_token to your $HOME/.hubicfuse file
  7. Mount hubic to your server:
    mkdir /mnt/hubic
    hubicfuse /mnt/hubic -o noauto_cache,sync_read,allow_other
  8. Add the mount point to /etc/fstab:
    hubicfuse /mnt/hubic fuse user,noauto 0 0
  9. Run rsync with –no-times directive to avoid “failed to set times” error:
    rsync -uptorgvlHaz /home/ /mnt/hubic/backup/home --no-times
  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
    umount -l /mnt/hubic
    hubicfuse /mnt/hubic -o noauto_cache,sync_read,allow_other

Leave a Reply