Wednesday, October 16, 2019

Check whether a machine is virtual machine

How to check whether a machine is virtual machine?

$ hostnamectl status

if the output shows  "Chassis: vm" , it is virtual machine.

For physical machine it shows something like "Chassis: laptop"

Another command to try
$  systemd-detect-virt



Friday, October 4, 2019

LinchPin tool

LinchPin is a simple and flexible hybrid cloud orchestration tool. Its intended purpose is managing cloud resources across multiple infrastructures. These resources can be provisioned, decommissioned, and configured all using declarative data and a simple command-line interface.

GitHub link:

Thursday, September 26, 2019

Thursday, September 19, 2019

Vagrant + libvirt in Fedora



Install libvirt and qemu:
   dnf -y install qemu libvirt libvirt-devel ruby-devel gcc
    Install vagrant:

    Install vagrant plugin for libvirt:
    vagrant plugin install vagrant-libvirt
    First init the Vagrantfile
    vagrant init fedora/29-cloud-base

    // Note: You can check whether the corresponding image present here


    // without any specific OS:
    vagrant init

    You need to update Vagrant file with specific OS before proceeding.

    To create and configure and to bring up the VM
    vagrant up --provider=libvirt


    You can find your downloaded box here:
    ls ~/.vagrant.d/boxes/


    vagrant status
    // only for current directory

    vagrant global-status
    // global for this user

    vagrant halt  <id>

    id is received in global-status command above

    To start again:
    vagrant provision

    or  you can run the same command as:
    vagrant up --provision 

    You can also avoid running it by
    vagrant up --no-provision 

    // To login
    vagrant ssh


    // To destroy specific box

    vagrant destroy

    // Note, the above will not remove the box from the system (from backend). To remove it you can use

    vagrant box remove  


    // remembers state
    vagrant suspend

    // To resume
    vagrant resume


    // To stop
    vagrant halt

    // List all the boxes in your system:
    vagrant box list


    // To share files between host and VM

    // option in Vagrantfile
      config.vm.synced_folder "../data", "/vagrant_data"

    Here ../data => directory in Host
    /vagrant_data => directory in VM

    Ensure you have working NFS server in host.
    Also, udp=y in /etc/nfs.conf in the host machine.


    vagrant reload ->  vagrant halt + vagrant up

    // along with provision
    vagrant reload --provision


    // provider specific changes in Vagrantfile
       vb.memory = "value"
       vb.cpus = "value"


    // to package a new vagrant box
    vagrant package


    // to save the state of VM
    vagrant suspend

    // to resume the snapshot
    vagrant resume