I want to be able to mount LVM partitions that are xen guests when shut down of course. The reason I can''t is cause I am not doing it right. :( I just do not know where I am going wrong. I start by creating the logical volume #lvcreate --size 10g --name test01.max /dev/xen-system #Logical volume "test01.max" created Install to the new logical volume #root@max02:/home/virt# virt-install #Would you like a fully virtualized guest (yes or no)? This will allow you to run unmodified operating systems. yes #What is the name of your virtual machine? test01.max #How much RAM should be allocated (in megabytes)? 1000 #What would you like to use as the disk (file path)? /dev/xen-system/test01.max #Would you like to enable graphics support? (yes or no) yes #What is the virtual CD image, CD device or install location? /export/home0/erin/ISO/CentOS-5.2-x86_64-netinstall.iso Finish install #Guest installation complete... restarting guest. Shut down new guest #root@max02:/etc/xen# xm shutdown test01.max Then try to mount the lvm I found a number of tutorials on how to do this like this; http://linuxwave.blogspot.com/2008/02/accessing-data-on-xen-lvm-guest-image.html I tried to stick with the manual from Red Hat and that did not work either; http://www.centos.org/docs/5/html/Virtualization-en-US/ch-virt-accessing-data.html despite the 2 typos. #root@max02:~# cd /dev/xen-system/ #root@max02:/dev/xen-system# ls -l #total 0 #lrwxrwxrwx 1 root root 34 Jan 7 15:25 test01.max -> /dev/mapper/xen--system-test01.max # #root@max02:/dev/xen-system# fdisk -lu test01.max # #Disk test01.max: 10.7 GB, 10737418240 bytes #255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors #Units = sectors of 1 * 512 = 512 bytes # # Device Boot Start End Blocks Id System #test01.max1 * 63 208844 104391 83 Linux #test01.max2 208845 20964824 10377990 8e Linux LVM #root@max02:/dev/xen-system# vgscan # Reading all physical volumes. This may take a while... # Found volume group "xen-system" using metadata type lvm2 # Found volume group "VolGroup00" using metadata type lvm2 #root@max02:/dev/xen-system# vgchange -ay xen-system # 6 logical volume(s) in volume group "xen-system" now active #root@max02:/dev/xen-system# lvs # LV VG Attr LSize Origin Snap% Move Log Copy% Convert # LogVol00 VolGroup00 -wi-ao 929.47G # LogVol01 VolGroup00 -wi-ao 1.94G # test01.max xen-system -wi-a- 10.00G This is the part I do not understand what am I supposed to be mounting .... I think the first one should work. But I did not create a file system on /dev/xen-system/test01.max I just installed to it. I have tried creating a ext3 file system under and then installing to that but was still not able to mount the instance. (Which makes sense to me at least.) #root@max02:/dev/xen-system# mount /dev/xen-system/test01.max /mnt #mount: you must specify the filesystem type #root@max02:/dev/xen-system# mount -t ext3 /dev/xen-system/test01.max /mnt #mount: wrong fs type, bad option, bad superblock on /dev/xen-system/test01.max, # missing codepage or other error # In some cases useful info is found in syslog - try # dmesg | tail or so #root@max02:/dev/xen-system# dmesg | tail #device vif1.0 entered promiscuous mode #ADDRCONF(NETDEV_UP): vif1.0: link is not ready #tun: Universal TUN/TAP device driver, 1.6 #tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> #device tap0 entered promiscuous mode #xenbr0: topology change detected, propagating #xenbr0: port 4(tap0) entering forwarding state #tap0: no IPv6 routers present #hfs: unable to find HFS+ superblock #VFS: Can''t find ext3 filesystem on dev dm-7. I am sure I am missing something basic here. Can some one please enlighten me? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
All you need to do is; 1. Have a mount point, eg /mnt/tmp 2. mount /dev/xen-system/test01.max /mnt/tmp That is really all that is needed. You may need to specify the filesystem, but mount will complain if it needs it. eg; root@newnewyork:/mnt/tmp# lvscan|grep utils ACTIVE ''/dev/vm-storage/utils-disk'' [5.00 GB] inherit ACTIVE ''/dev/vm-storage/utils-swap'' [512.00 MB] inherit root@newnewyork:/tmp# mount /dev/vm-storage/utils-disk /mnt/tmp/ root@newnewyork:/tmp# cd /mnt/tmp/ root@newnewyork:/mnt/tmp# ls -l total 88 drwxr-xr-x 2 root root 4096 2008-07-17 18:17 bin drwxr-xr-x 2 root root 4096 2006-10-29 00:07 boot drwxr-xr-x 4 root root 4096 2008-07-17 18:09 dev drwxr-xr-x 48 root root 4096 2008-12-26 13:07 etc drwxr-xr-x 3 root root 4096 2008-07-17 18:14 home drwxr-xr-x 2 root root 4096 2008-06-14 19:19 initrd drwxr-xr-x 9 root root 4096 2008-07-17 21:27 lib lrwxrwxrwx 1 root root 4 2008-07-17 18:11 lib64 -> /lib drwx------ 2 root root 16384 2008-06-14 19:15 lost+found drwxr-xr-x 2 root root 4096 2008-06-14 19:19 media drwxr-xr-x 2 root root 4096 2006-10-29 00:07 mnt drwxr-xr-x 2 root root 4096 2008-06-14 19:19 opt drwxr-xr-x 2 root root 4096 2006-10-29 00:07 proc drwxr-xr-x 2 root root 4096 2008-09-13 14:25 root drwxr-xr-x 2 root root 4096 2008-07-17 18:11 sbin drwxr-xr-x 2 root root 4096 2008-06-14 19:19 srv drwxr-xr-x 2 root root 4096 2008-01-21 20:33 sys drwxrwxrwt 2 root root 4096 2008-09-13 14:26 tmp drwxr-xr-x 10 root root 4096 2008-07-17 18:11 usr drwxr-xr-x 14 root root 4096 2008-07-17 18:21 var 2009/1/7 Eredicator X <eredicatorx@hugedesigns.net>> I want to be able to mount LVM partitions that are xen guests when shut > down of course. > > The reason I can''t is cause I am not doing it right. :( I just do not know > where I am going wrong. > > I start by creating the logical volume > > #lvcreate --size 10g --name test01.max /dev/xen-system > #Logical volume "test01.max" created > > > Install to the new logical volume > > #root@max02:/home/virt# virt-install > #Would you like a fully virtualized guest (yes or no)? This will allow you > to run unmodified operating systems. yes > #What is the name of your virtual machine? test01.max > #How much RAM should be allocated (in megabytes)? 1000 > #What would you like to use as the disk (file path)? > /dev/xen-system/test01.max > #Would you like to enable graphics support? (yes or no) yes > #What is the virtual CD image, CD device or install location? > /export/home0/erin/ISO/CentOS-5.2-x86_64-netinstall.iso > > Finish install > > #Guest installation complete... restarting guest. > > Shut down new guest > > #root@max02:/etc/xen# xm shutdown test01.max > > Then try to mount the lvm I found a number of tutorials on how to do this > like this; > > http://linuxwave.blogspot.com/2008/02/accessing-data-on-xen-lvm-guest-image.html > > I tried to stick with the manual from Red Hat and that did not work either; > > http://www.centos.org/docs/5/html/Virtualization-en-US/ch-virt-accessing-data.htmldespite the 2 typos. > > > #root@max02:~# cd /dev/xen-system/ > #root@max02:/dev/xen-system# ls -l > #total 0 > #lrwxrwxrwx 1 root root 34 Jan 7 15:25 test01.max -> > /dev/mapper/xen--system-test01.max > # > #root@max02:/dev/xen-system# fdisk -lu test01.max > # > #Disk test01.max: 10.7 GB, 10737418240 bytes > #255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors > #Units = sectors of 1 * 512 = 512 bytes > # > # Device Boot Start End Blocks Id System > #test01.max1 * 63 208844 104391 83 Linux > #test01.max2 208845 20964824 10377990 8e Linux LVM > #root@max02:/dev/xen-system# vgscan > # Reading all physical volumes. This may take a while... > # Found volume group "xen-system" using metadata type lvm2 > # Found volume group "VolGroup00" using metadata type lvm2 > #root@max02:/dev/xen-system# vgchange -ay xen-system > # 6 logical volume(s) in volume group "xen-system" now active > #root@max02:/dev/xen-system# lvs > # LV VG Attr LSize Origin Snap% Move Log Copy% > Convert > # LogVol00 VolGroup00 -wi-ao 929.47G > # LogVol01 VolGroup00 -wi-ao 1.94G > # test01.max xen-system -wi-a- 10.00G > > > This is the part I do not understand what am I supposed to be mounting .... > I think the first one should work. But I did not create a file system on > /dev/xen-system/test01.max I just installed to it. > I have tried creating a ext3 file system under and then installing to that > but was still not able to mount the instance. (Which makes sense to me at > least.) > > #root@max02:/dev/xen-system# mount /dev/xen-system/test01.max /mnt > #mount: you must specify the filesystem type > > #root@max02:/dev/xen-system# mount -t ext3 /dev/xen-system/test01.max /mnt > #mount: wrong fs type, bad option, bad superblock on > /dev/xen-system/test01.max, > # missing codepage or other error > # In some cases useful info is found in syslog - try > # dmesg | tail or so > > #root@max02:/dev/xen-system# dmesg | tail > #device vif1.0 entered promiscuous mode > #ADDRCONF(NETDEV_UP): vif1.0: link is not ready > #tun: Universal TUN/TAP device driver, 1.6 > #tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> > #device tap0 entered promiscuous mode > #xenbr0: topology change detected, propagating > #xenbr0: port 4(tap0) entering forwarding state > #tap0: no IPv6 routers present > #hfs: unable to find HFS+ superblock > #VFS: Can''t find ext3 filesystem on dev dm-7. > > I am sure I am missing something basic here. Can some one please enlighten > me? > > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Mark Walkom wrote:> All you need to do is; > > 1. Have a mount point, eg /mnt/tmp > 2. mount /dev/xen-system/test01.max /mnt/tmp > > That is really all that is needed.I don''t think that''s true. When using virt-install, the LV will be treated as a whole disk. Thus it may have partitions, or even PV/LV inside it.> > 2009/1/7 Eredicator X <eredicatorx@hugedesigns.net > <mailto:eredicatorx@hugedesigns.net>> > > I want to be able to mount LVM partitions that are xen guests when > shut down of course. > > #root@max02:/home/virt# virt-install > #Would you like a fully virtualized guest (yes or no)? This will > allow you to run unmodified operating systems. yes > #What is the name of your virtual machine? test01.max > #How much RAM should be allocated (in megabytes)? 1000 > #What would you like to use as the disk (file path)? > /dev/xen-system/test01.max > #Would you like to enable graphics support? (yes or no) yes > #What is the virtual CD image, CD device or install location? > /export/home0/erin/ISO/CentOS-5.2-x86_64-netinstall.iso >CentOS (as is RedHat) uses LVM inside guests by default. If you let it like that, then mounting domU filesystem in dom0 is going to be a pain. Not impossible, but certainly not easy. I''d actually suggest one of the followings : - startup domU, setup nfs, have dom0 mount domU''s share, or - reinstall domU with virt-install, choose partitioning setup (not LVM) on domU, or - reinstall domU WITHOUT virt-install, use LVS on dom0 directly as filesystem on domU (e.g. no more partioning or LVM on domU). This is not possible using anaconda, thus have to be done manually. Or, - learn how to use kpartx, pvscan, and vgscan, and hope you don''t have conflicting VG names. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thanks Mark, I tried that as well. But it does not mount. I think what I am failing to understand here is when I create a guest on a lvm as I did here;> > #What would you like to use as the disk (file path)? > > /dev/xen-system/test01.maxWhat is the underlying file system type that is created? If I try to mount it w/o a type it says "mount: you must specify the filesystem type" When I try to mount it with ext3 it does not mount and gives this error.> > #mount: wrong fs type, bad option, bad superblock on > > /dev/xen-system/test01.max, > > # missing codepage or other error > > # In some cases useful info is found in syslog - try > > # dmesg | tail or so----- "Mark Walkom" <markwalkom@gmail.com> wrote:> All you need to do is; > > 1. Have a mount point, eg /mnt/tmp > 2. mount /dev/xen-system/test01.max /mnt/tmp > > That is really all that is needed. > You may need to specify the filesystem, but mount will complain if it > needs > it. > > eg; > root@newnewyork:/mnt/tmp# lvscan|grep utils > ACTIVE ''/dev/vm-storage/utils-disk'' [5.00 GB] inherit > ACTIVE ''/dev/vm-storage/utils-swap'' [512.00 MB] inherit > root@newnewyork:/tmp# mount /dev/vm-storage/utils-disk /mnt/tmp/ > root@newnewyork:/tmp# cd /mnt/tmp/ > root@newnewyork:/mnt/tmp# ls -l > total 88 > drwxr-xr-x 2 root root 4096 2008-07-17 18:17 bin > drwxr-xr-x 2 root root 4096 2006-10-29 00:07 boot > drwxr-xr-x 4 root root 4096 2008-07-17 18:09 dev > drwxr-xr-x 48 root root 4096 2008-12-26 13:07 etc > drwxr-xr-x 3 root root 4096 2008-07-17 18:14 home > drwxr-xr-x 2 root root 4096 2008-06-14 19:19 initrd > drwxr-xr-x 9 root root 4096 2008-07-17 21:27 lib > lrwxrwxrwx 1 root root 4 2008-07-17 18:11 lib64 -> /lib > drwx------ 2 root root 16384 2008-06-14 19:15 lost+found > drwxr-xr-x 2 root root 4096 2008-06-14 19:19 media > drwxr-xr-x 2 root root 4096 2006-10-29 00:07 mnt > drwxr-xr-x 2 root root 4096 2008-06-14 19:19 opt > drwxr-xr-x 2 root root 4096 2006-10-29 00:07 proc > drwxr-xr-x 2 root root 4096 2008-09-13 14:25 root > drwxr-xr-x 2 root root 4096 2008-07-17 18:11 sbin > drwxr-xr-x 2 root root 4096 2008-06-14 19:19 srv > drwxr-xr-x 2 root root 4096 2008-01-21 20:33 sys > drwxrwxrwt 2 root root 4096 2008-09-13 14:26 tmp > drwxr-xr-x 10 root root 4096 2008-07-17 18:11 usr > drwxr-xr-x 14 root root 4096 2008-07-17 18:21 var > > > 2009/1/7 Eredicator X <eredicatorx@hugedesigns.net> > > > I want to be able to mount LVM partitions that are xen guests when > shut > > down of course. > > > > The reason I can''t is cause I am not doing it right. :( I just do > not know > > where I am going wrong. > > > > I start by creating the logical volume > > > > #lvcreate --size 10g --name test01.max /dev/xen-system > > #Logical volume "test01.max" created > > > > > > Install to the new logical volume > > > > #root@max02:/home/virt# virt-install > > #Would you like a fully virtualized guest (yes or no)? This will > allow you > > to run unmodified operating systems. yes > > #What is the name of your virtual machine? test01.max > > #How much RAM should be allocated (in megabytes)? 1000 > > #What would you like to use as the disk (file path)? > > /dev/xen-system/test01.max > > #Would you like to enable graphics support? (yes or no) yes > > #What is the virtual CD image, CD device or install location? > > /export/home0/erin/ISO/CentOS-5.2-x86_64-netinstall.iso > > > > Finish install > > > > #Guest installation complete... restarting guest. > > > > Shut down new guest > > > > #root@max02:/etc/xen# xm shutdown test01.max > > > > Then try to mount the lvm I found a number of tutorials on how to do > this > > like this; > > > > > http://linuxwave.blogspot.com/2008/02/accessing-data-on-xen-lvm-guest-image.html > > > > I tried to stick with the manual from Red Hat and that did not work > either; > > > > > http://www.centos.org/docs/5/html/Virtualization-en-US/ch-virt-accessing-data.htmldespite > the 2 typos. > > > > > > #root@max02:~# cd /dev/xen-system/ > > #root@max02:/dev/xen-system# ls -l > > #total 0 > > #lrwxrwxrwx 1 root root 34 Jan 7 15:25 test01.max -> > > /dev/mapper/xen--system-test01.max > > # > > #root@max02:/dev/xen-system# fdisk -lu test01.max > > # > > #Disk test01.max: 10.7 GB, 10737418240 bytes > > #255 heads, 63 sectors/track, 1305 cylinders, total 20971520 > sectors > > #Units = sectors of 1 * 512 = 512 bytes > > # > > # Device Boot Start End Blocks Id System > > #test01.max1 * 63 208844 104391 83 Linux > > #test01.max2 208845 20964824 10377990 8e Linux > LVM > > #root@max02:/dev/xen-system# vgscan > > # Reading all physical volumes. This may take a while... > > # Found volume group "xen-system" using metadata type lvm2 > > # Found volume group "VolGroup00" using metadata type lvm2 > > #root@max02:/dev/xen-system# vgchange -ay xen-system > > # 6 logical volume(s) in volume group "xen-system" now active > > #root@max02:/dev/xen-system# lvs > > # LV VG Attr LSize Origin Snap% Move Log > Copy% > > Convert > > # LogVol00 VolGroup00 -wi-ao 929.47G > > # LogVol01 VolGroup00 -wi-ao 1.94G > > # test01.max xen-system -wi-a- 10.00G > > > > > > This is the part I do not understand what am I supposed to be > mounting .... > > I think the first one should work. But I did not create a file > system on > > /dev/xen-system/test01.max I just installed to it. > > I have tried creating a ext3 file system under and then installing > to that > > but was still not able to mount the instance. (Which makes sense to > me at > > least.) > > > > #root@max02:/dev/xen-system# mount /dev/xen-system/test01.max /mnt > > #mount: you must specify the filesystem type > > > > #root@max02:/dev/xen-system# mount -t ext3 > /dev/xen-system/test01.max /mnt > > #mount: wrong fs type, bad option, bad superblock on > > /dev/xen-system/test01.max, > > # missing codepage or other error > > # In some cases useful info is found in syslog - try > > # dmesg | tail or so > > > > #root@max02:/dev/xen-system# dmesg | tail > > #device vif1.0 entered promiscuous mode > > #ADDRCONF(NETDEV_UP): vif1.0: link is not ready > > #tun: Universal TUN/TAP device driver, 1.6 > > #tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> > > #device tap0 entered promiscuous mode > > #xenbr0: topology change detected, propagating > > #xenbr0: port 4(tap0) entering forwarding state > > #tap0: no IPv6 routers present > > #hfs: unable to find HFS+ superblock > > #VFS: Can''t find ext3 filesystem on dev dm-7. > > > > I am sure I am missing something basic here. Can some one please > enlighten > > me? > > > > > > _______________________________________________ > > Xen-users mailing list > > Xen-users@lists.xensource.com > > http://lists.xensource.com/xen-users > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Good point, I generally keep my partitions separate, everything under / and then swap as a separate LV. 2009/1/7 Fajar A. Nugraha <fajar@fajar.net>> Mark Walkom wrote: > > All you need to do is; > > > > 1. Have a mount point, eg /mnt/tmp > > 2. mount /dev/xen-system/test01.max /mnt/tmp > > > > That is really all that is needed. > > I don''t think that''s true. > When using virt-install, the LV will be treated as a whole disk. Thus it > may have partitions, or even PV/LV inside it. > > > > > 2009/1/7 Eredicator X <eredicatorx@hugedesigns.net > > <mailto:eredicatorx@hugedesigns.net>> > > > > I want to be able to mount LVM partitions that are xen guests when > > shut down of course. > > > > #root@max02:/home/virt# virt-install > > #Would you like a fully virtualized guest (yes or no)? This will > > allow you to run unmodified operating systems. yes > > #What is the name of your virtual machine? test01.max > > #How much RAM should be allocated (in megabytes)? 1000 > > #What would you like to use as the disk (file path)? > > /dev/xen-system/test01.max > > #Would you like to enable graphics support? (yes or no) yes > > #What is the virtual CD image, CD device or install location? > > /export/home0/erin/ISO/CentOS-5.2-x86_64-netinstall.iso > > > > CentOS (as is RedHat) uses LVM inside guests by default. If you let it > like that, then mounting domU filesystem in dom0 is going to be a pain. > Not impossible, but certainly not easy. > > I''d actually suggest one of the followings : > - startup domU, setup nfs, have dom0 mount domU''s share, or > - reinstall domU with virt-install, choose partitioning setup (not LVM) > on domU, or > - reinstall domU WITHOUT virt-install, use LVS on dom0 directly as > filesystem on domU (e.g. no more partioning or LVM on domU). This is not > possible using anaconda, thus have to be done manually. Or, > - learn how to use kpartx, pvscan, and vgscan, and hope you don''t have > conflicting VG names. > > Regards, > > Fajar > > > > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thanks Fajar, ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote:> I don''t think that''s true. > When using virt-install, the LV will be treated as a whole disk. Thus > it > may have partitions, or even PV/LV inside it.Yes it does and that is what I was using kpart for.> CentOS (as is RedHat) uses LVM inside guests by default. If you let > it > like that, then mounting domU filesystem in dom0 is going to be a > pain. > Not impossible, but certainly not easy. >Yes agreed.> I''d actually suggest one of the followings : > - startup domU, setup nfs, have dom0 mount domU''s share, or > - reinstall domU with virt-install, choose partitioning setup (not > LVM) > on domU, orThese are just test machines so reinstalling is not a issue. My true end goal is to clone a guest, make a script that mounts it changes some parameters like IP and Users etc. Unmounts it and starts it. Simple down and dirty provisioning. Simple goal. Painful execution.> - reinstall domU WITHOUT virt-install, use LVS on dom0 directly as > filesystem on domU (e.g. no more partioning or LVM on domU). This is > not > possible using anaconda, thus have to be done manually.Not sure I follow you on this one.> - learn how to use kpartx, pvscan, and vgscan, and hope you don''t > have > conflicting VG names. >This is what I am currently trying to do. Thanks in advance, Erin _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Eredicator X schrieb: > Thanks Fajar, > > ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote: > >> I don''t think that''s true. >> When using virt-install, the LV will be treated as a whole disk. Thus >> it >> may have partitions, or even PV/LV inside it. > > Yes it does and that is what I was using kpart for. To mount it, you need to calc your offset, try something like: # fdisk -l -u /dev/lvmpart Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors Units = sectors of 1 * 512 = 512 bytes Disk identifier: 0x000c11fd Device Boot Start End Blocks Id System /dev/sda1 * 63 39086144 19543041 fd Linux raid autodetect /dev/sda2 39086145 41062139 987997+ 82 Linux swap / Solaris /dev/sda3 41062140 312576704 135757282+ fd Linux raid autodetect To mount the first sda-Partition ( 512 bytes * 63 = 32256 ) # losetup -o 32256 /dev/loop0 /dev/lvmpart # mount /dev/loop0 /target/ or # mount -o loop,offset=32256 /dev/lvmpart /target/ Maybe it helps, Fabian _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Eredicator X wrote:> ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote: > > >> I don''t think that''s true. >> When using virt-install, the LV will be treated as a whole disk. Thus >> it >> may have partitions, or even PV/LV inside it. >> > > Yes it does and that is what I was using kpart for. > >I must''ve missed your post about using kpartx.>> I''d actually suggest one of the followings : >> - startup domU, setup nfs, have dom0 mount domU''s share, or >> - reinstall domU with virt-install, choose partitioning setup (not >> LVM) >> on domU, or >> > > These are just test machines so reinstalling is not a issue. > My true end goal is to clone a guest, make a script that mounts it changes some parameters like IP and Users etc. Unmounts it and starts it. Simple down and dirty provisioning. > > Simple goal. Painful execution. > >Depends. I''ll tell you how to do it easily at the end of this email :D>> - reinstall domU WITHOUT virt-install, use LVS on dom0 directly as >> filesystem on domU (e.g. no more partioning or LVM on domU). This is >> not >> possible using anaconda, thus have to be done manually. >> > > Not sure I follow you on this one. > >Read on, comments below.>> - learn how to use kpartx, pvscan, and vgscan, and hope you don''t >> have >> conflicting VG names. >> >> > > This is what I am currently trying to do. > > >Okay. From your post, I gather that /dev/xen-system/test01.max is LV on dom0 used for domU''s disk. I don''t see you using kpartx. If fdisk -l says # Device Boot Start End Blocks Id System #test01.max1 * 63 208844 104391 83 Linux #test01.max2 208845 20964824 10377990 8e Linux LVM Then running "kpartx -av /dev/xen-system/test01.max" should create /dev/mapper/test01.max1 and /dev/mapper/test01.max2 (or something similar). /dev/mapper/test01.max1 -> domU''s /boot /dev/mapper/test01.max2 -> domU''s PV You can mount /dev/mapper/test01.max1 to get domU''s /boot, but to get domU''s "/" you need to do more. After you get /dev/mapper/test01.max2, try running pvscan and vgscan again and pray that you get a new VG. That would be domU''s VG. IMHO, the steps above are painful. So I''d suggest that you reinstall using only one partition (/) WITHOUT LVM, WITHOUT SWAP. If you don''t have enough memory and absolutely need swap, use another LV on dom0 for that (in other words, domU will have two disks : one for /, one for swap). This way, you don''t need vgscan (and don''t have to worry about conflicting VG names) anymore. You simply need fdisk and kpartx (for both the working domU and the new domU). There is another method which uses dom0''s LV directly as domU''s fs. Assuming you have succesfully mount a working domU, you can do something like this : - create two new LV''s on dom0 : /dev/xen-system/test03root and /dev/xen-system/test03swap - mkfs.ext3 /dev/xen-system/test03root - mkswap /dev/xen-system/test03swap - mount /dev/xen-system/test03root somewhere - copy all files from the working domU (including /boot) with either rsync -av, cp -av, or tar (I like tar better) - adjust new domU''s config file to look like this memory = "2000" disk = [ ''phy:/dev/xen-system/test03root,xvda1,w'', ''phy:/dev/xen-system/test03swap,xvda2,w'', ] Note the difference : it''s xvda1 and xvda2, NOT xvda and xvdb. you can use either hda1/2, sda1/2, or xvda1/2. xvda is probably best on Centos. - edit new domU''s fstab to use xvda1 as "/" and xvda2 as swap - unmount new domU''s fs - startup new domU - create an archive (tar.gz or something) of the original domU. That way, subsequent domU''s only need to extract from that archive. This way you don''t need fdisk, kpartx, or pv/vgscan to create another domU. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
"Fajar A. Nugraha" <fajar@fajar.net> writes:> Eredicator X wrote: > >> ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote: >> >>> - learn how to use kpartx, pvscan, and vgscan, and hope you don''t >>> have conflicting VG names. >> >> This is what I am currently trying to do. > > [...] > > IMHO, the steps above are painful. So I''d suggest that you reinstall > using only one partition (/) WITHOUT LVM, WITHOUT SWAP.In my experience, LVM inside domUs is very useful. It makes persistent naming, snapshotting, live resizing or migration to new storage possible. These may not count on a test system, but they do when you provide some important service via your domU. But then you should be familiar with the LVM tools anyway, so the above can''t be a problem. And conflicting VG names is a disaster anyway. Usually I set each to something meaningful, like the host name for example. -- YMMV, cheers, Feri. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Wed, Jan 7, 2009 at 6:25 PM, Ferenc Wagner <wferi@niif.hu> wrote:> "Fajar A. Nugraha" <fajar@fajar.net> writes: > >> Eredicator X wrote: >> >>> ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote: >>> >>>> - learn how to use kpartx, pvscan, and vgscan, and hope you don''t >>>> have conflicting VG names. >>> >>> This is what I am currently trying to do. >> >> [...] >> >> IMHO, the steps above are painful. So I''d suggest that you reinstall >> using only one partition (/) WITHOUT LVM, WITHOUT SWAP. > > In my experience, LVM inside domUs is very useful.I find it a matter of preference and whom you get support from. I believe RedHat''s recommendation is : - use dom0''s HD, partition, or file as domU storage (not LVM) - use LVM on domU I prefer the other way around : - use dom0''s LV as domU storage - use domU''s disk directly without additional partitioning or LVM Using LVM on both dom0 and domU, like what Eredicator is using, adds something like 3% performance penalty.> It makes > persistent naming, snapshotting, live resizing or migration to new > storage possible. These may not count on a test system, but they do > when you provide some important service via your domU. >In my case : - persistent naming is done on dom0 using LVM. DomU always get the same LV as hda1/xvda1. - resizing is done by resizing dom0''s LV. No live resize possible as domU reboot required (or unmount and xm detach/attach) - migration (I assume it''s moving/copying domU to another dom0, not live migration) can be done by copying dom0''s LV contents (snapshotting when necessary) So I lost live resizing ability, but avoided the 3% performance penalty. Plus, I get the ability to clone or rescue domUs easily.> But then you should be familiar with the LVM tools anyway, so the > above can''t be a problem.Correct.> -- > YMMVAgreed. Seems like LVM on domU works best for you. Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Eredicator X wrote on Wed, 7 Jan 2009 17:26:24 +0900 (JST):> My true end goal is to clone a guest, make a script that mounts it > changes some parameters like IP and Users etc. Unmounts it and starts > it. Simple down and dirty provisioning.Then you want to go with filesystems on Dom0 partitions (LVM volumes just being partitions in this regard). Install your "template machine" to a file, tweak everything you want, create a LV with filesystem, then rsync (with --numeric-ids) the contents of that VM (while it is running) to it, adjust files (grub.conf, fstab maybe others) at the new location (you can mount it now without problems) and you''ve got your new VM template ready. When you want to create new VMs, create new LV, create fs, tunefs and then copy over the content from the template and adjust it. Template VM is offline all the time and only needs to be started in case you want to update it or change something. Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> Eredicator X wrote: > >> ----- "Fajar A. Nugraha" <fajar@fajar.net> wrote: >> >> >> >>> I don''t think that''s true. >>> When using virt-install, the LV will be treated as a whole disk. Thus >>> it >>> may have partitions, or even PV/LV inside it. >>> >>> >> Yes it does and that is what I was using kpart for. >> >> >> > I must''ve missed your post about using kpartx. > > >>> I''d actually suggest one of the followings : >>> - startup domU, setup nfs, have dom0 mount domU''s share, or >>> - reinstall domU with virt-install, choose partitioning setup (not >>> LVM) >>> on domU, or >>> >>> >> These are just test machines so reinstalling is not a issue. >> My true end goal is to clone a guest, make a script that mounts it changes some parameters like IP and Users etc. Unmounts it and starts it. Simple down and dirty provisioning. >> >> Simple goal. Painful execution. >> >> >> > Depends. I''ll tell you how to do it easily at the end of this email :D > > > >>> - reinstall domU WITHOUT virt-install, use LVS on dom0 directly as >>> filesystem on domU (e.g. no more partioning or LVM on domU). This is >>> not >>> possible using anaconda, thus have to be done manually. >>> >>> >> Not sure I follow you on this one. >> >> >> > > Read on, comments below. > > >>> - learn how to use kpartx, pvscan, and vgscan, and hope you don''t >>> have >>> conflicting VG names. >>> >>> >>> >> This is what I am currently trying to do. >> >> >> >> > > Okay. From your post, I gather that /dev/xen-system/test01.max is LV on > dom0 used for domU''s disk. > I don''t see you using kpartx. > > If fdisk -l says > > # Device Boot Start End Blocks Id System > #test01.max1 * 63 208844 104391 83 Linux > #test01.max2 208845 20964824 10377990 8e Linux LVM > > Then running "kpartx -av /dev/xen-system/test01.max" should create > /dev/mapper/test01.max1 and /dev/mapper/test01.max2 (or something similar). > > /dev/mapper/test01.max1 -> domU''s /boot > /dev/mapper/test01.max2 -> domU''s PV > > You can mount /dev/mapper/test01.max1 to get domU''s /boot, but to get > domU''s "/" you need to do more. After you get /dev/mapper/test01.max2, > try running pvscan and vgscan again and pray that you get a new VG. That > would be domU''s VG. > > IMHO, the steps above are painful. So I''d suggest that you reinstall > using only one partition (/) WITHOUT LVM, WITHOUT SWAP. If you don''t > have enough memory and absolutely need swap, use another LV on dom0 for > that (in other words, domU will have two disks : one for /, one for > swap). This way, you don''t need vgscan (and don''t have to worry about > conflicting VG names) anymore. You simply need fdisk and kpartx (for > both the working domU and the new domU). > > There is another method which uses dom0''s LV directly as domU''s fs. > Assuming you have succesfully mount a working domU, you can do something > like this : > > - create two new LV''s on dom0 : /dev/xen-system/test03root and > /dev/xen-system/test03swap > - mkfs.ext3 /dev/xen-system/test03root > - mkswap /dev/xen-system/test03swap > - mount /dev/xen-system/test03root somewhere > - copy all files from the working domU (including /boot) with either > rsync -av, cp -av, or tar (I like tar better) > - adjust new domU''s config file to look like this > > memory = "2000" > disk = [ > ''phy:/dev/xen-system/test03root,xvda1,w'', > ''phy:/dev/xen-system/test03swap,xvda2,w'', > ] > > Note the difference : it''s xvda1 and xvda2, NOT xvda and xvdb. > you can use either hda1/2, sda1/2, or xvda1/2. xvda is probably best on > Centos. > > - edit new domU''s fstab to use xvda1 as "/" and xvda2 as swap > - unmount new domU''s fs > - startup new domU > - create an archive (tar.gz or something) of the original domU. That > way, subsequent domU''s only need to extract from that archive. > > This way you don''t need fdisk, kpartx, or pv/vgscan to create another domU. > > Regards, > > Fajar > > ------------------------------------------------------------------------ > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> Okay. From your post, I gather that /dev/xen-system/test01.max is LV on > dom0 used for domU''s disk. > I don''t see you using kpartx. > > If fdisk -l says > > # Device Boot Start End Blocks Id System > #test01.max1 * 63 208844 104391 83 Linux > #test01.max2 208845 20964824 10377990 8e Linux LVM > > Then running "kpartx -av /dev/xen-system/test01.max" should create > /dev/mapper/test01.max1 and /dev/mapper/test01.max2 (or something similar). > > /dev/mapper/test01.max1 -> domU''s /boot > /dev/mapper/test01.max2 -> domU''s PV > > You can mount /dev/mapper/test01.max1 to get domU''s /boot, but to get > domU''s "/" you need to do more. After you get /dev/mapper/test01.max2, > try running pvscan and vgscan again and pray that you get a new VG. That > would be domU''s VG. > > IMHO, the steps above are painful. So I''d suggest that you reinstall > using only one partition (/) WITHOUT LVM, WITHOUT SWAP. If you don''t > have enough memory and absolutely need swap, use another LV on dom0 for > that (in other words, domU will have two disks : one for /, one for > swap). This way, you don''t need vgscan (and don''t have to worry about > conflicting VG names) anymore. You simply need fdisk and kpartx (for > both the working domU and the new domU). > > There is another method which uses dom0''s LV directly as domU''s fs. > Assuming you have succesfully mount a working domU, you can do something > like this : > > - create two new LV''s on dom0 : /dev/xen-system/test03root and > /dev/xen-system/test03swap > - mkfs.ext3 /dev/xen-system/test03root > - mkswap /dev/xen-system/test03swap > - mount /dev/xen-system/test03root somewhere > - copy all files from the working domU (including /boot) with either > rsync -av, cp -av, or tar (I like tar better) > - adjust new domU''s config file to look like this > > memory = "2000" > disk = [ > ''phy:/dev/xen-system/test03root,xvda1,w'', > ''phy:/dev/xen-system/test03swap,xvda2,w'', > ] > > Note the difference : it''s xvda1 and xvda2, NOT xvda and xvdb. > you can use either hda1/2, sda1/2, or xvda1/2. xvda is probably best on > Centos. > > - edit new domU''s fstab to use xvda1 as "/" and xvda2 as swap > - unmount new domU''s fs > - startup new domU > - create an archive (tar.gz or something) of the original domU. That > way, subsequent domU''s only need to extract from that archive. > > This way you don''t need fdisk, kpartx, or pv/vgscan to create another domU. > >Fajar, Fabian, Mark, Thanks for your advice on this I am going to spend the day trying to tackle this inbetween what ever fires break out and will let you know how it goes later. E./ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users