KVM virtual machine on Centos 8 - Change name and Create snapshots

KVM virtual machine on Centos 8 - Change name and Create snapshots

Virtualisation provide a more efficient use of memory, disk and all CPU on a server. Separate servers can be managed within a single server. Centos 8 provide virtual machine (VM) management through KVM (kernel virtual machine).

?Each VM is given a domain name. Common practice before upgrading a server operating system, is to create a backup the current VM, or as its known here, a snapshot. Default format in use is qcow2, where tools for snapshot will work. Through Virtual Machine Manager and Cockpit, virtual machines can be created and managed.?

No alt text provided for this image

Creating of virtual machines is not covered in here as its quite straight forward. Mostly it depends on the organisation practise and best practises.

Pre-requisite:

  • Centos 8 is installed with virtual machine manager.
  • A virtual machine is already added with the name "Centos7_php"

?Let's work with an existing VM named "Centos7_php". This virtual machine is installed with the operating system Centos Linux 8 and all the other packages required as a PHP development server. This requires the VM to be shutdown (and there are no snapshots)

DISPLAY AVAILABLE RUNNING VMDISPLAY AVAILABLE RUNNING VM

Syntax:?

virsh list

SHUTDOWN VM

Syntax:

virsh shutdown {domain}

virsh shutdown Centos7_php        

RENAME VM

Syntax:?

virsh domrename {domain} {new_name}

virsh domrename Centos7_php php_development        

STARTUP VM

Note: The following will continue to use the initial VM name of Centos7_php.

Syntax:?

virsh start {domain}

virsh start Centos7_php        

RETRIEVE VM CONFIGURATION

Syntax:?

virsh dumpxml {domain}

LIST AVAILABLE SNAPSHOTS FOR A DOMAIN

Syntax:

virsh snapshot-list --domain {domain}

CREATE A SNAPSHOT

Snapshots can be created while a VM is running. Best practise would be to stop the VM, where possible. The reason why double-quotes are used here, is that its common to have snapshot name with spaces. But no so for the domain name.

Syntax:

virsh snapshot-create-as --domain {domain} --name "{snapshot_name}"

View details of a snapshot with syntax:

virsh snapshot-info --domain {domain} --name "{snapshot_name}"

Example of creating a snapshot, then showing its details

virsh snapshot-create-as --domain Centos7_php \?
? --name "2021July" --description "Snapshot initial stages"
virsh snapshot-list --domain Centos7_php
virsh snapshot-info --domain Centos7_php --name "2021July"?
        

REVERT TO A SPECIFIC SNAPSHOT

Ensure the VM is shutdown before switching to a snapshot. Here is the syntax and an example.

Syntax:

virsh --snapshot-revert --domain {domain} --snapshotname "{snapshot_name}"

Example to switch to a snapshot known and initial.

virsh shutdown Centos7_php
virsh --snapshot-revert --domain Centos7_php \
? ? ?--snapshotname "2021July"
virsh start Centos7_php?        

DELETE A SNAPSHOT

Each snapshot takes up disk space, and these can be removed when not in use anymore.

Syntax:

virsh --snapshot-delete --domain {domain} --snapshotname "{snapshot_name}"

Example to delete a snapshot

virsh --snapshot-delete --domain Centos7_php \
    --snapshotname "2021July"?        

--This post is to try out Linkedin Publishing function, after over a year ago. My original post is at blogspot site--


要查看或添加评论,请登录

Nicholas S.的更多文章

  • Saving Keras Model

    Saving Keras Model

    The Python3 command line is great to test out commands, and the ipython is the improvement on is as it provided a more…

  • Machine Learning with TensorFlow and Keras on Ubuntu - Part 3

    Machine Learning with TensorFlow and Keras on Ubuntu - Part 3

    Having installed TensorFlow on a machine with GPU and being able to verify that the GPU is in use, this next article…

  • Machine Learning with TensorFlow and Keras on Ubuntu - Part 2

    Machine Learning with TensorFlow and Keras on Ubuntu - Part 2

    So far, the base system and drivers have been installed and these are what I have installed on Windows 11, WSL2. One…

  • Machine Learning with TensorFlow and Keras on Ubuntu - Part 1

    Machine Learning with TensorFlow and Keras on Ubuntu - Part 1

    I was interested to understand better how computers solve complex problems like recognising images and extract meaning…

  • Show git differences between commits

    Show git differences between commits

    In managing code sources, GIT approach expects the code to be at different stages, which are "staged" or "commit"…

  • Server performance limits

    Server performance limits

    Stress test tools provide a planned approach to simulate multiple user access to servers. The most commonly used is…

  • VUE for Single Page Application

    VUE for Single Page Application

    AngularJS (the oldest of the 3) and ReactJS have been at the limelight of the latest technologies in the area of Single…

  • Amazing Malaysians - Hew Ah Kow

    Amazing Malaysians - Hew Ah Kow

    What does a half boiled egg maker and a 3-pin plug have in common? When Hew Ah Kow introduced a plastic ware to make…

  • Software version control with Git

    Software version control with Git

    Software development involving more than 1 developers will surely benefit from the use of a software version control…

  • Raspberry Pi: Getting Started

    Raspberry Pi: Getting Started

    Was considering on several options for "embedded systems" and finally settled with Raspberry Pi. Getting Started

社区洞察

其他会员也浏览了