Jordi Segues
2007-Apr-19 13:06 UTC
Re: [Xen-users] Managing DomU partitions in XEN+LVM systems?
Hello, I have a similar problem: I have a Windows 2003 domU in an LVM partition. I want to enlarge this partition in order to have more space for windows 2003. So in your post you say:> That would seem trivial to do, from within dom0 (while the domU is not > running of course.) Just use: > - lvextend to enlarge the volume > - fdisk (or parted) to enlarge the partition > - ntfsresize to enlarge the filesystembut for me the problem is that fdisk can''t enlarge a partition! It says you must delete it and then recreate it, but if I do this I lose all my 2003 system. How can I enlarge my 2003 partition (and update the MBR for windows to recognize it)? ntfsresize tells me: Current volume size: 10470748672 bytes (10471 MB) Current device size: 10470749184 bytes (10471 MB) New volume size : 10470744576 bytes (10471 MB) Nothing to do: NTFS volume size is already OK. So my LVM partition have been enlarged, but ntfsresize don''t see it. You solved it with fdisk? and how? Windows 2003 is in one big partition, so it will need to boot after the resize :) Thanks for your help! Jordi.S On 1/31/07, Derek <xen@sherlockmail.com> wrote:> Hi all, > > This is more an LVM question than a XEN one. But hopefully not too far off > topic for the Xen list... > > I am running an HVM domU partitions (WinXP). I assigned a root drive that > is an LVM logical volume as seen by the Dom0, in other words: > > disk = [ ''phy:/dev/mapper/main-root_disk_winxp,hda,w'' , > ... others ... ] > > WinXP''s installer sees the logical volume as a whole disk, and promptly > partitions it. So, it ends up with a partition table and one large NTFS > filesystem partition. > > Now later, I decided to enlarge the logical volume, it''s associated > partition, and it''s associated NTFS filesystem. > > That would seem trivial to do, from within dom0 (while the domU is not > running of course.) Just use: > - lvextend to enlarge the volume > - fdisk (or parted) to enlarge the partition > - ntfsresize to enlarge the filesystem > > The first two steps work flawlessly. The third step is problematic, because > ntfsresize wants to be told the device path to the _partition_, not to the > _whole_disk_. Well, /dev/mapper/main-root_disk_winxp is > the whole disk, but there''s no corresponding > /dev/mapper/main-root_disk_winxp1 for the paritition on > it. LVM+UDEV+DM don''t give you one. > > I''m not stuck, I have a workaround yet to try: linux in a domU, and run > fdisk+ntfsresize there. The linux DomU will presumably contain a device > nodes for the partition, and I can run ntfsresize within it. But I''m asking > this because I''m sure there''s a more elegant solution, and someone on this > list probably knows it. Surely there''s a way to persuade LVM+UDEV+DM to > produce device nodes for each partition within each logical volume? (I know > roughly how to write UDEV rules, but this problem goes beyond that, and I > definitely don''t understand the device mapper). > > Thanks, > Derek. > > _______________________________________________ > 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 Williamson
2007-Apr-19 17:56 UTC
Re: [Xen-users] Managing DomU partitions in XEN+LVM systems?
> I have a Windows 2003 domU in an LVM partition. > I want to enlarge this partition in order to have more space for windows > 2003. > > So in your post you say: > > That would seem trivial to do, from within dom0 (while the domU is not > > running of course.) Just use: > > - lvextend to enlarge the volume > > - fdisk (or parted) to enlarge the partition > > - ntfsresize to enlarge the filesystem > > but for me the problem is that fdisk can''t enlarge a partition! It > says you must delete it and then recreate it, but if I do this I lose > all my 2003 system.Well, in principle I guess that ought to work, right? I mean the data will still be there, and once you''ve recreated the partition table it should be possible to find the filesystem again. Mmm? Maybe try it on a copy for safety''s sake? Doesn''t Windows have any facility for expanding filesystems? Worst case, you could just export another drive to Windows (and, if you want, mount it somewhere in the filesystem hierarchy - 2k3 can do that). Cheers, Mark> How can I enlarge my 2003 partition (and update the MBR for windows to > recognize it)? > > ntfsresize tells me: > > Current volume size: 10470748672 bytes (10471 MB) > Current device size: 10470749184 bytes (10471 MB) > New volume size : 10470744576 bytes (10471 MB) > Nothing to do: NTFS volume size is already OK. > > So my LVM partition have been enlarged, but ntfsresize don''t see it. > You solved it with fdisk? and how? > > Windows 2003 is in one big partition, so it will need to boot after > the resize :) > > Thanks for your help! > > Jordi.S > > On 1/31/07, Derek <xen@sherlockmail.com> wrote: > > Hi all, > > > > This is more an LVM question than a XEN one. But hopefully not too far > > off topic for the Xen list... > > > > I am running an HVM domU partitions (WinXP). I assigned a root drive > > that is an LVM logical volume as seen by the Dom0, in other words: > > > > disk = [ ''phy:/dev/mapper/main-root_disk_winxp,hda,w'' , > > ... others ... ] > > > > WinXP''s installer sees the logical volume as a whole disk, and promptly > > partitions it. So, it ends up with a partition table and one large NTFS > > filesystem partition. > > > > Now later, I decided to enlarge the logical volume, it''s associated > > partition, and it''s associated NTFS filesystem. > > > > That would seem trivial to do, from within dom0 (while the domU is not > > running of course.) Just use: > > - lvextend to enlarge the volume > > - fdisk (or parted) to enlarge the partition > > - ntfsresize to enlarge the filesystem > > > > The first two steps work flawlessly. The third step is problematic, > > because ntfsresize wants to be told the device path to the _partition_, > > not to the _whole_disk_. Well, /dev/mapper/main-root_disk_winxp is > > the whole disk, but there''s no corresponding > > /dev/mapper/main-root_disk_winxp1 for the paritition on > > it. LVM+UDEV+DM don''t give you one. > > > > I''m not stuck, I have a workaround yet to try: linux in a domU, and run > > fdisk+ntfsresize there. The linux DomU will presumably contain a device > > nodes for the partition, and I can run ntfsresize within it. But I''m > > asking this because I''m sure there''s a more elegant solution, and > > someone on this list probably knows it. Surely there''s a way to persuade > > LVM+UDEV+DM to produce device nodes for each partition within each > > logical volume? (I know roughly how to write UDEV rules, but this > > problem goes beyond that, and I definitely don''t understand the device > > mapper). > > > > Thanks, > > Derek. > > > > _______________________________________________ > > 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-- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 4/19/07, Jordi Segues <jordisd.mailing@gmail.com> wrote:> but for me the problem is that fdisk can''t enlarge a partition! It > says you must delete it and then recreate it, but if I do this I lose > all my 2003 system.When I did it, I just used fdisk to delete the partition, and then to re-create a new one of the larger size. The new one must start at the exact same cylinder as the old one did, but can have more cylinders. It''s a little scary because of the messages about data loss, but it worked fine for me. To the best of my knowledge, fdisk doesn''t touch any other part of the disk other than the partition table, so provided the new partition is larger than the old, and begins at the same position as the old, everything works fine. One precaution I took -- and I recommend you do the same. I first backed up the entire logical volume, by creating another one of the same size and using dd to copy the content. That way, if did anything stupid and broke my windows filesystem, I''d have been able to recreate it. Derek. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Jordi Segues
2007-Apr-20 11:51 UTC
Re: [Xen-users] Managing DomU partitions in XEN+LVM systems?
Hello, Thanks for your answers. It''s exact, when you recreate the table the data is not lost. There are my commands: #You extend your LVM partition lvextend -L +5G /dev/LVM/2003-clone #Open cfdisk fdisk /dev/LVM/2003-clone #Delete NTFS partition #Recreate a bigger NTFS partition #Put the boot flag #We write changes "W" #Quit cfdisk #We make a ntfsresize, it will extend the old NTFS filesystem to the new size of the LVM partition kpartx -a /dev/LVM/2003-clone ntfsresize /dev/mapper/2003-clonep1 kpartx -d /dev/LVM/2003-clone #Now windows 2003 boots perfectly, without data loss and with more disk space ;) On 4/20/07, Derek <xen@sherlockmail.com> wrote:> On 4/19/07, Jordi Segues <jordisd.mailing@gmail.com> wrote: > > but for me the problem is that fdisk can''t enlarge a partition! It > > says you must delete it and then recreate it, but if I do this I lose > > all my 2003 system. > > When I did it, I just used fdisk to delete the partition, and then to > re-create a new one of the larger size. The new one must start at the > exact same cylinder as the old one did, but can have more cylinders. It''s a > little scary because of the messages about data loss, but it worked fine for > me. > > To the best of my knowledge, fdisk doesn''t touch any other part of the disk > other than the partition table, so provided the new partition is larger than > the old, and begins at the same position as the old, everything works fine. > > One precaution I took -- and I recommend you do the same. I first backed up > the entire logical volume, by creating another one of the same size and > using dd to copy the content. That way, if did anything stupid and broke my > windows filesystem, I''d have been able to recreate it. > > Derek. > > _______________________________________________ > 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 Williamson
2007-Apr-23 21:50 UTC
Re: [Xen-users] Managing DomU partitions in XEN+LVM systems?
Awesome! I thought this would work (assuming ntfsresize coped with it). If you get a chance, it would be really good to have this solution recorded in the Xen wiki (http://wiki.xensource.com/) Cheers, Mark On Friday 20 April 2007, Jordi Segues wrote:> Hello, > > Thanks for your answers. > It''s exact, when you recreate the table the data is not lost. > > There are my commands: > > #You extend your LVM partition > lvextend -L +5G /dev/LVM/2003-clone > > #Open cfdisk > fdisk /dev/LVM/2003-clone > > #Delete NTFS partition > #Recreate a bigger NTFS partition > #Put the boot flag > #We write changes "W" > #Quit cfdisk > > #We make a ntfsresize, it will extend the old NTFS filesystem to the > new size of the LVM partition > kpartx -a /dev/LVM/2003-clone > ntfsresize /dev/mapper/2003-clonep1 > kpartx -d /dev/LVM/2003-clone > > #Now windows 2003 boots perfectly, without data loss and with more disk > space ;) > > On 4/20/07, Derek <xen@sherlockmail.com> wrote: > > On 4/19/07, Jordi Segues <jordisd.mailing@gmail.com> wrote: > > > but for me the problem is that fdisk can''t enlarge a partition! It > > > says you must delete it and then recreate it, but if I do this I lose > > > all my 2003 system. > > > > When I did it, I just used fdisk to delete the partition, and then to > > re-create a new one of the larger size. The new one must start at the > > exact same cylinder as the old one did, but can have more cylinders. > > It''s a little scary because of the messages about data loss, but it > > worked fine for me. > > > > To the best of my knowledge, fdisk doesn''t touch any other part of the > > disk other than the partition table, so provided the new partition is > > larger than the old, and begins at the same position as the old, > > everything works fine. > > > > One precaution I took -- and I recommend you do the same. I first backed > > up the entire logical volume, by creating another one of the same size > > and using dd to copy the content. That way, if did anything stupid and > > broke my windows filesystem, I''d have been able to recreate it. > > > > Derek. > > > > _______________________________________________ > > 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-- Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Sorry to intrude into a past thread. But I merely did an lvextend on a windows image, and then Xen completely refuses to boot itself. It just hangs at the initial ''booting from harddisk'' stage, and doesn''t even go to windows. I am using Xen 3.0.4 on RHEL-5. Is this a bug in Xen-3.0? Can someone confirm that what''s explained below works properly in practice? I extended the partition using parted, but even then it doesn''t go past the initial stage. But again, shouldn''t windows boot if you merely do an lvextend. I mean, I am not expecting it to automatically fill the new space--for that ntfsresize, and parted/fdisk are needed--but should Xen hang at the beginning itself on a mere lvextend? what''s the Xen version Jordi used? Thanks a lot in advance. On Friday 20 April 2007, Jordi Segues wrote:> Hello, > > Thanks for your answers. > It''s exact, when you recreate the table the data is not lost. > > There are my commands: > > #You extend your LVM partition > lvextend -L +5G /dev/LVM/2003-clone > > #Open cfdisk > fdisk /dev/LVM/2003-clone > > #Delete NTFS partition > #Recreate a bigger NTFS partition > #Put the boot flag > #We write changes "W" > #Quit cfdisk > > #We make a ntfsresize, it will extend the old NTFS filesystem to the > new size of the LVM partition > kpartx -a /dev/LVM/2003-clone > ntfsresize /dev/mapper/2003-clonep1 > kpartx -d /dev/LVM/2003-clone > > #Now windows 2003 boots perfectly, without data loss and with more disk > space ;) >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users