I need to migrate one CentOS5 (32bit) physical server to in a virtual machine. My idea is to take a snapshot of the LV and then import in kvm creating a new vm. Is this a good idea? More precisely, I have one disk:
[root@cs5 ~]# fdisk -l
Disco /dev/sda: 292.3 GB, 292326211584 byte
255 heads, 63 sectors/track, 35539 cylinders
Unità = cilindri di 16065 * 512 = 8225280 byte
Dispositivo Boot Start End Blocks Id System
/dev/sda1 1 9 72261 de Dell Utility
/dev/sda2 * 10 271 2104515 b W95 FAT32
/dev/sda3 272 284 104422+ 83 Linux
/dev/sda4 285 35539 283185787+ 5 Esteso
/dev/sda5 285 35539 283185756 8e Linux LVM
and
[root@cs5 ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda3 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
So pv, vg and lv are:
[root@cs5 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 VolGroup00 lvm2 a- 270,06G 0
[root@cs5 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 270,06G 0
[root@cs5 ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 264,91G
LogVol01 VolGroup00 -wi-ao 5,16G
As showed, I have /dev/sda3 mounted in /boot and 2 LV, one for / and another that works as swap partition. I think that the only snapshot I need is LogVol00, right?
At this point, I need to add another disk to the PV and then add it to the VG and finally create the snapshot with
lvcreate -L XXG -s -n data_snap /dev/VolGroup00/LogVol00
Now, how can I import that snapshot in a vm? I can create a tar.gz of the snapshot or I can use dd, but I don't have a boot partition for the vm. Should I first install a new vm and then (booting in single mode) overwrite all files in / (except /boot) ?? Is there some other method?? Thanks