LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 08-02-2021, 12:28 PM   #1
ludomania007
LQ Newbie
 
Registered: Jun 2021
Posts: 5

Rep: Reputation: Disabled
Moving an existing install into a virtual machine


I'm trying using this tutorial https://wiki.archlinux.org/title/Mov...ving_into_a_VM To move one my server into a VMWare virtual machine, i succeed to export the images and open it into ESXI but when i chroot into the VM, the VM cannot see any partition, Fdisk command failed.

As the rsync command exclude the proc folder is there any solution to fix that?
 
Old 08-02-2021, 02:29 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,020

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
There are more than a few ways to do it.

If you insist on using vmware then consider their method. Example. https://www.nakivo.com/blog/vmware-p...e-walkthrough/

Not sure what way I'd suggest to clone to virtual. Generally I do a copy of entire disk to a virtual hard drive after making the virtual machine config.

As to your client state I can't guess yet. Almost any issue can be the cause.
 
Old 08-22-2021, 10:15 PM   #3
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Some distributions install a virtual optimized kernel in VMs.

For myself when I transferred a Linux who's kernel I compile, I will run command: lspci -vk from a Linux Live in VMWare to get a list of all kernel drivers in use and compile a second kernel with support and add it to the boot menu. If your distribution has different kernel for virtualization, install it prior to transfer.

Since I typically have basic partition layout: ESP, Root, Swap. I adjust the size of Root with Gparted Live ( usually shrink it ) and make an image of it, restore the size if desired.

In VMWare I create a new 64MB EFI system partition, same size Root partition as the image, Swap partition. Format the ESP and Swap, then paste the Root image into it's partition. Boot to live CD, adjust /etc/fstab commenting out Data drives, change UUID of ESP entry etc. Then chroot into Root to reinstall Grub (which I find has to be done whether you copied the ESP or not). Reboot and boot the appropriate kernel.

EDIT: Then if needed, expand the virtual disk and run Gparted Live to adjust partitions, it's easy to kill Swap to expand Root and create/format new Swap behind it.

Last edited by Brains; 08-22-2021 at 10:22 PM.
 
Old 08-24-2021, 11:09 AM   #4
ludomania007
LQ Newbie
 
Registered: Jun 2021
Posts: 5

Original Poster
Rep: Reputation: Disabled
@Brains,

I should admit that i didn't succeed to implement your suggestions. Because i d'ont rally know how to compile a second kernel and add it to the boot menu. I look from the physical machine and that is the ppartition on boot disk.

Quote:
root@cide-sie:/boot# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 300GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 boot, esp
2 538MB 300GB 299GB ext4

(parted)
I tried this tutorial to correct the grub https://communities.vmware.com/t5/Co...244895#2844710

But after it the boot partition could not be mounted anymore. It's when i try to understand that i notice that my boot partition is EFI.
 
Old 08-24-2021, 08:02 PM   #5
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Quote:
Originally Posted by ludomania007 View Post
@Brains,

I should admit that i didn't succeed to implement your suggestions. Because i d'ont rally know how to compile a second kernel and add it to the boot menu. I look from the physical machine and that is the ppartition on boot disk.
That's just my approach, get it ready to minimize the amount of work from single user/live mode in VMWare to get it booteed. I'm an Image freak, I'm always making backups of my OS partitions, not the ESP. On my EFI system I can create new partitions somewhere else on the drive and paste a Linux OS image in it and boot it without going into chroot/single user/live mode.

However, not with VMWare. I back up my important VMs the same way, take a compressed image of it. I've had Gentoo Linux in VMWare, it's folder quickly becomes the same size as the allocated disk size. The Gentoo only used 12GB of the 30GB disk, all the tmp space it used to compile software is seen as used space by VMWare. So it's folder constantly grows to to max allocated disk size. The backup software I use don't include un-allocated disk space, the image file size is about 5GB as a result. I then create a new VM and use partition software live to create a new ESP and a partition same size or larger as the partition the image came from, then with the backup software, plaster the image in it, then boot a live Linux to reinstall grub, then she boots, and it's back to 12GB in size.

With VMWare, I've found, one way or another, whether you created a new ESP or carried the original as part of the image, you will need to reinstall grub from a live environment.

You can take your chances with the current kernel, some distributions like Fedora have a very inclusive kernel with great support for virtualization either as host or guest.

The image software I use is not free and I won't recommend it as such as it also has a learning curve. What I can recommend since you only have two partitions:
Boot Gparted Live and shrink your ext4 root partition to bare minimum and note the size. Boot Linux live and make a "dd" bit for bit image of the / partition only using 4K bite size in the command, then boot Gparted Live and expand the partition back to it's original size, everything should be normal with the installed OS.

Make a new VM allocating desired "max" disk size, boot Gparted Live in the VM to create a new ESP at 64MB because no other OS will be adding boot files in it, it don't need be larger. And a partition same size as the shrunk partition size the image came from, the size you noted. Then boot Linux Live to dd the image into the partition, mount it and the ESP partition, and fix /etc/fstab to include the proper UUID for the partitions, reinstall grub, boot Gparted Live to expand the partition to max allocated size.

Last edited by Brains; 08-25-2021 at 12:26 AM.
 
Old 09-18-2021, 03:08 AM   #6
Vmwaretyu
LQ Newbie
 
Registered: Sep 2021
Location: HK
Posts: 5

Rep: Reputation: Disabled
Is your disk a virtual disk or a direct physical hard disk? If it is the latter, I'm afraid you can't fdisk
 
  


Reply

Tags
virtual machines, vmware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to : Open Virtual Machine Manager to create a new virtual machine BKChicago Linux - Newbie 2 11-08-2016 09:48 PM
Looking For A Bootable OS + Virtual Machine Combo - Bootable Virtual Machine OS Help angelbabycry Linux - Newbie 7 05-08-2015 08:36 PM
how to know the remote machine is Virtual machine or physical machine pantdk Linux - Server 19 10-16-2014 01:48 PM
Is base memory of virtual machine used when virtual machine is not running? ravisingh1 Linux - Virtualization and Cloud 3 04-09-2013 03:41 AM
Running virtual pc files in a virtual machine in linux ... preferably virtual box biharibong Linux - Software 4 01-21-2009 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 08:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration