Re: Backup KVM Guest VM in OVA or VMDK format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, Sep 20, 2022 at 3:38 PM Ondřej Budai <obudai@xxxxxxxxxx> wrote:

> Hi Kaushal,
>
> st 14. 9. 2022 v 16:07 odesílatel Kaushal Shriyan <
> kaushalshriyan@xxxxxxxxx>
> napsal:
>
> > On Fri, Sep 2, 2022 at 5:41 PM Fabian Arrotin <arrfab@xxxxxxxxxx> wrote:
> >
> > > On 01/09/2022 18:14, Kaushal Shriyan wrote:
> > > > Hi,
> > > >
> > > > Is there a way to backup KVM Guest VM running CentOS Linux release
> > > 7.9.2009
> > > > (Core) OS in kvmguestosimage.ova or kvmguestosimage.vmdk format as I
> am
> > > > trying to restore it in AWS by referring to
> > > > https://aws.amazon.com/ec2/vm-import/ article as per the below
> > supported
> > > > file format.
> > > >
> > > > [1] Open Virtualization Archive (OVA)
> > > > [2] Virtual Machine Disk (VMDK)
> > > > [3] Virtual Hard Disk (VHD/VHDX)
> > > > [4] raw
> > > >
> > > > Also any method to take full and incremental backup of KVM Guest VM.
> > > >
> > > > Any help will be highly appreciated. I look forward to hearing from
> > you.
> > > > Thanks in Advance.
> > > >
> > > > Best Regards,
> > > >
> > > > Kaushal
> > >
> > > Stop the vm
> > > qemu-img convert -f raw origin.qcow2 dest.raw
> > >
> > > You can then import but while we use this to create official centos
> > > image, don't forget to ensure that you node is ready to be imported, so
> > > cloud-init, etc, etc
> > >
> > > It's usually easier/better/faster to have automation in place to
> > > configure an application and so replay it on a new node, and then
> > > replicate data
> > >
> > > I guess only option why you'd want to not do this is that it's a
> running
> > > machine that was configured "by hands" by someone who left the company
> > > (and so without automation in place)
> > >
> > > --
> > > Fabian Arrotin
> > > The CentOS Project | https://www.centos.org
> > > gpg key: 17F3B7A1 | twitter: @arrfab
> > > _______________________________________________
> > > CentOS mailing list
> > > CentOS@xxxxxxxxxx
> > > https://lists.centos.org/mailman/listinfo/centos
> >
> >
> > Thanks Fabian for the detailed email. I followed the below steps by
> > referring to
> >
> >
> https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html
> > .
> >
> > # qemu-img -h | grep Supported
> > Supported formats: blkdebug blklogwrites blkverify compress
> > copy-before-write copy-on-read file ftp ftps gluster host_cdrom
> host_device
> > http https iscsi iser luks nbd null-aio null-co nvme preallocate qcow2
> > quorum raw rbd ssh throttle vhdx vmdk vpc
> >
> > # qemu-img --version
> > qemu-img version 6.2.0 (qemu-kvm-6.2.0-12.module_el8.7.0+1140+ff0772f9)
> > Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
> > #
> >
> > *Step No. 1*
> > #qemu-img convert -O vmdk openapibox.img openapibox.vmdk -p
> >
>
> I'm not 100% sure but I think that AWS only accepts the stream-optimized
> subformat, the command is:
>
> $ qemu-img convert -O vmdk -o subformat=streamOptimized openapibox.img
> openapibox.vmdk
>
>
> >
> > *Step No. 2*
> > #aws ec2 import-image --disk-containers
> > Format=vmdk,UserBucket="{S3Bucket=daclabservers,S3Key=openapidbox.vmdk}"
> > {
> >     "ImportTaskId": "import-ami-0232f452194f6efe0",
> >     "Progress": "1",
> >     "SnapshotDetails": [
> >         {
> >             "DiskImageSize": 0.0,
> >             "Format": "VMDK",
> >             "UserBucket": {
> >                 "S3Bucket": "daclabservers",
> >                 "S3Key": "openapibox.vmdk"
> >             }
> >         }
> >     ],
> >     "Status": "active",
> >     "StatusMessage": "pending"
> > }
> >
>
> Our project (https://www.osbuild.org/) uses the raw format for disks,
> uploads it to S3, calls import-snapshot to import it as an EBS snapshot and
> finally calls register-image to create a new AMI. Basically:
>
> $ qemu-img convert -O raw openapibox.img openapibox.raw
> # upload into S3
> $ aws ec2 import-snapshot ...
> # wait for the snapshot to be imported
> $ aws ec2 register-image ...
>
> Docs:
> - https://docs.aws.amazon.com/cli/latest/reference/ec2/register-image.html
> -
> https://docs.aws.amazon.com/cli/latest/reference/ec2/import-snapshot.html
> -
>
> https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-import-snapshot.html
>
> If you want to see this in practice, we have some Go code. As awscli is
> just a thin wrapper over the API, it should be pretty easy to translate our
> code into awscli calls:
>
> https://github.com/osbuild/osbuild-composer/blob/bfd90cf191eece5c1331dcb43a85bcca02d8d7d4/internal/cloud/awscloud/awscloud.go#L211
>
> Hope that helps,
>
> Ondřej
>

Thanks Ondřej and appreciate it. I will try it out and keep you posted.
Thanks in advance.

Best Regards,

Kaushal
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux