Virtualbox Cloning to make new SNs



  • I’ve had to do get rid of, change and recreate new SN so many time due to not having dedicated hardware for the SN. I had been using the 6200 pro boxes we had around. Thus, whenever we needed to replace our old dc5700s and dc7700s, instead of buying new hardware, we used the same set of 6200s. And since my project wasn’t business critical (even though it saved us about $100 per month) I was forced to adapt. Just another day in I.T.

    So I did a little write up on how to make new FOG storage nodes without having to reinstall everything by using the cloning feature in Oracle’s Virtualbox.

    Cloning a FOG Storage Node virtual machine (VirtualBox)

    This guide assumes you have Ubuntu 16.04 with FOG trunk installed (Currently 1.3.0 RC11).
    The best time to do the cloning is after running the installer, but before adding the Node to the main server, so that an images aren’t also cloned.

    1. First step, do a shutdown of the system. Go to the VirtualBox manager window and right click on the VM and click on ‘Clone…’

    0_1475098158862_FogSNClone_1.PNG

    The dialogue box will ask you for the name, type of clone, how you want any possible snapshots handled and if you want to change the MAC address. The name is just what appears in VirtualBox, so choose whatever you desire there.

    0_1475098167509_FogSNClone_2.PNG

    In this example, we want the new VM to be as independent from the parent VM as possible, so set Clone type to ‘Full Clone’, Snapshots to ‘Everything’ and check to reinitialize any MAC address. Then click ‘Clone.’ This process can take a while, even though there aren’t any images, depending on disk speed.

    0_1475098173143_FogSNClone_3.PNG

    1. Next we will start up the new VM. The username and password will be the same as the parent VM. After logging in, enter
    sudo nano /etc/network/interfaces
    

    This will bring up the configuration file for NICs on the VM, use the arrow keys to navigate. In this example, there is only one interface, though you may have more. The dns-search option will most likely refer to your domain name if you are a Windows environment and dns-nameservers are the IP addresses, not hostnames, of DNS servers. After filling the information in, press Control-X, then y followed by enter. This will save the interface configuration.

    0_1475098394045_FogSNClone_4.PNG

    1. Next up, we will change the hostname to reflect what we made the name in VirtualBox (you can change it to whatever in your own environment.) To edit both of the files we need to change enter:
    sudo nano /etc/hosts
    
    sudo nano /etc/hostname
    

    In both examples shown, the hostname has already been changed from “FogUbunSN1” to “FogUbunSN3.”

    0_1475098384906_FogSNClone_5.PNG

    0_1475098374887_FogSNClone_6.PNG

    1. IMPORTANT, make sure you now reboot the VM, so that it can apply all of the setting we just modified.

    2. Now we will modify the FOG installers settings file to reflect the changes we’ve made. Enter

    sudo nano /opt/fog/.fogsettings
    

    On the screen displayed, the only option that we need to change is the first one ‘ipaddress’. For security you can also change the ‘password’ field, though using a password generator is recommended.

    1. If you used a SSH connection you can leave the SSH keys the same, but if you went to the trouble of being more security with the first storage node, why not with the clone. If you don’t have OpenSSH installed, use
    sudo apt-get install openssh-server
    
    1. . First off, generate your SSH keys. Putty’s key generator is used in this example. (You can also change the bit amount to 4096, which is what is used in all the keys in this example)

    0_1475098360481_FogSNClone_7.PNG

    After generating the keys, the public key will be displayed, along with field for ‘Key comment’ and ‘Key passphrase’ both of these field are optional, though the VMs hostname is common in the comment field. You should then have both the public and private keys in a secure location. To get the public key on the VM, this example uses a password secured SSH connection, though you can use other methods. Run the following commands

    mkdir ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
    

    To create the key file. Paste the public key into file by copying the text and then right clicking inside the putty window. This should paste the key as a single line of text. After saving and closing the file, run

    chmod 600 ~/.ssh/authorized_keys
    
    1. All that’s left to do now is run the installer and add the node to the main FOG server
    cd /root/fogproject/bin
    ./installfog.sh
    

    :EOF

    If you notice any tipos, grammatical error, things I did wrong in

    STR="bash"
    echo $str
    

    or things I did wrong in FOG, please don’t be afraid to comment

    Sources:
    https://help.ubuntu.com/lts/serverguide/network-configuration.html
    https://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none
    https://support.hostgator.com/articles/specialized-help/technical/ssh-keying-through-putty-on-windows-or-linux

    And of course

    https://wiki.fogproject.org/wiki/index.php


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.