Nuno L. Ferreira
2010-Mar-28 13:42 UTC
[Xen-users] Get rid of the partition table in a domU LVM
Dear *, This is still related to one of my previous posts ... just digesting it into small pieces. In the past I was able to get rid of the partition table of a domU (either image file or LVM based) by : 1 - mounting the domU (mount -o loop, kpartx and alike) 2 - copying the contents into a fresh LV 3 - edit the xen configuration files, as well as fstab and grub.conf if needed 4 - boot the new LV domU with pygrub and ... that''s it. I found that not having the partition table was easy to handle, whenever I want to make a backup (either dd or tar) and restore it (and that''s what I read many times also). I only need to take care of the consistency of the filesystem of the LVM, not worrying myself with the consistency of the partition table. But now I''m not being able to do it in a fresh CentOS54 x86_64 xen aware dom0, while using the old 4.8 version (those times still using x86 for both domU and dom0) I was not experiencing any problems. Someone with experience in this matter? Tot ziens, N. Possible something has changed in the default xen installed in the 4.x and 5.x CentOS e -- =============================================Nuno Ricardo Santos Loureiro da Silva Ferreira NMR Spectroscopy Research Group Bijvoet Center for Biomolecular Research Utrecht University Bloembergen gebouw Padualaan 8, 3584 CH Utrecht The Netherlands P: +31.(0)30.253 9932 F: +31.(0)30.253 2652 E: n.l.ferreira@uu.nl W: http://nmr.chem.uu.nl ============================================= _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nuno L. Ferreira
2010-Mar-28 14:28 UTC
[Xen-users] Re: Get rid of the partition table in a domU LVM
As an example to complement, the step by step protocol, knowing the following: 1 - dom0 is a CentOS 54 x86_64 AMD server 2 - /dev/vg1/domu.pristine hosts a SL 54 x86_64 PV domU which runs just fine; For simplicity, only one partition resides inside this LVM (/dev/xvda1 --> /). 3 - /dev/vg1/test will be my new LV domU host (lvcreate -L5G -n test vg1 ; mkfs.ext3 /dev/vg1/test) 4 - domU to copy is down. [dom0]# lvscan ACTIVE ''/dev/vg1/test'' [5.00 GB] inherit ACTIVE ''/dev/vg1/domu.pristine'' [4.00 GB] inherit [dom0]# fdisk -l /dev/vg1/domu.pristine Disk /dev/vg1/domu.pristine: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/vg1/domu.pristine1 * 1 522 4192933+ 83 Linux [dom0]# kpartx -l /dev/vg1/domu.pristine domu.pristine1 : 0 8385867 /dev/vg1/domu.pristine 63 [dom0]# kpartx -av /dev/vg1/domu.pristine add map domu.pristine1 : 0 8385867 linear /dev/vg1/domu.pristine 63 [dom0]# ls /dev/mapper/ | grep domu.pristine domu.pristine1 [dom0]# mount /dev/vg1/test /mnt/test [dom0]# mount /dev/vg1/domu.pristine /mnt/loop/ [dom0]# cp -ax /mnt/loop/* mnt/test [dom0]# umount /mnt/loop/ [dom0]# kpartx -dv /dev/vg1/domu.pristine After some tweeking on the new domU : [dom0]# cat /mnt/test/etc/fstab /dev/xvda1 / ext3 defaults 1 1 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 [dom0]# cat /mnt/test/etc/grub.conf ... snip ... default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title Scientific Linux (2.6.18-164.2.1.el5xen) root (hd0,0) kernel /boot/vmlinuz-2.6.18-164.2.1.el5xen ro root=/dev/xvda1 console=xvc0 rhgb quiet initrd /boot/initrd-2.6.18-164.2.1.el5xen.img [dom0]# umount /mnt/test [dom0]# cat test.xen name = "test" maxmem = 512 memory = 512 vcpus = 1 bootloader = "/usr/bin/pygrub" on_reboot = ''restart'' on_crash = ''restart'' on_poweroff = "destroy" disk = [ "phys:/dev/vg1/test,xvda1,w" ] vif = [ "bridge=xenbr0" ] [dom0]# xm dry-run test.xen Using config file "./test.xen". Checking domain: test: PERMITTED Checking resources: phys:/dev/vg1/test: PERMITTED Dry Run: PASSED [dom0]# xm create -c test.xen Using config file "./test.xen". Error: Device 51713 (vbd) could not be connected. Hotplug scripts not working. Pygrub shows up with one entry ... but then nothing else happens, just the above Error. Cheers, N. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Markus Hochholdinger
2010-Mar-29 18:42 UTC
Re: [Xen-users] Re: Get rid of the partition table in a domU LVM
Hello, Am 28.03.2010 um 16:28 Uhr schrieb "Nuno L. Ferreira" <nunolf@gmail.com>: [..]> [dom0]# xm create -c test.xen > Using config file "./test.xen". > Error: Device 51713 (vbd) could not be connected. Hotplug scripts not > working.this seems like a device (vbd) could not be connected! [..]> [dom0]# cat test.xen > name = "test" > maxmem = 512 > memory = 512 > vcpus = 1 > bootloader = "/usr/bin/pygrub" > on_reboot = ''restart'' > on_crash = ''restart'' > on_poweroff = "destroy" > disk = [ "phys:/dev/vg1/test,xvda1,w" ] > vif = [ "bridge=xenbr0" ]Are you sure it''s called phys? In my configs i have phy:/.. And have you verified "/usr/bin/pygrub" is there? Perhaps the file location has changed? [..] That''s all what comes to my mind. -- greetings eMHa _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users