[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-users] expanding Xen guest disk size
________________________________________ Von: sylvan.dcunha@xxxxxxxxx [mailto:sylvan.dcunha@xxxxxxxxx] Gesendet: Montag, 13. Juni 2011 16:58 An: Guido Hecken Betreff: Re: [Xen-users] expanding Xen guest disk size Dear All, I really thank and apprecite all your guys for the quick reply by the way I am using file based VM actually i just tried somting after i google arround. i did manage to extend the size of a centos based VM using dd from initial size of 5 gb to 15 gb restarted the vm and it comes up fine. but when i do a df -m i see the orinal size that is 5 GB but fdisk -l shows me the me 15 gb here below is the screen shots ------------- [root@testserver ~]# fdisk -l Disk /dev/hda: 15.7 GB, 15728640000 bytes 255 heads, 63 sectors/track, 1912 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 764 6032407+ 8e Linux LVM ----- root@testserver ~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 2821 1116 1560 42% / /dev/hda1 99 13 82 14% /boot tmpfs 742 0 742 0% /dev/shm --------- how could I get my df -m show me the entire space of 15 gb 2 gb has been set for swap You have to extend your partition(s) and filesystems inside the VM. Note the above Start and End areas of the first partition (hda1). Use parted or fdisk to: Delete partition 2 Delete partition 1 Create partition 1 Start (1) End (13) type 83 set active Create partition 2 Start (14) End (-1) type 8e Extend filesystem on /dev/mapper/VolGroup00-LogVol00 with the filesystemtools of the used filesystem(s). See man resize2fs or man xfs_growfs. Btw. xfs_growfs seems to work only on a mounted (running) filesystem. The question of resizing online or offline with resize2fs depends on your kernel and filesystem (etx2/ext3). Don't forget to backup your data before altering the partitiontables and filesystem stuff. Hope it helps... Regards, Guido I will test the windows VM next apprecite your kind help regards sylvan On Jun 13, 2011 2:04pm, Guido Hecken <guido.hecken@xxxxxxxxxxxxx> wrote: > > > > > -----Ursprüngliche Nachricht----- > > > > Von: xen-users-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-users- > > > > bounces@xxxxxxxxxxxxxxxxxxx] Im Auftrag von Fajar A. Nugraha > > > > Gesendet: Montag, 13. Juni 2011 09:49 > > > > An: Xen User-List > > > > Betreff: Re: [Xen-users] expanding Xen guest disk size > > > > > > > > On Mon, Jun 13, 2011 at 4:49 AM, Simon Hobson linux@xxxxxxxxxxxxxxxx> > > wrote: > > > > > sylvan.dcunha@xxxxxxxxx wrote: > > > > > > > > > >> I have been using Xen on centos and its been working grt.. > > > > >> I have 3 VM guest OS running on Xen under Centos 5.5 > > > > >> ... > > > > >> Now I recently ran into a problem that my centos guest VM and windows > > >> 2003 > > > > >> and slowly running out of space. > > > > > > > > > > You don't state what type of storage you use for the guest volumes, but > > > the > > > > > process is very similar for all of the options. > > > > > > > > > > 1) Enlarge the (virtual) block device. If it's a file based volume then > > > you > > > > > need to extend the file, if it's a partition then it's going to be hard, > > > if > > > > > it's on LVM then just do an lvextend on it. > > > > > > > > Be VERY careful if you're using file-backed domU storage. Most howtos > > > > involve using dd. If you do it wrong, you might end up destroying the > > > > file image. So better have a copy of the disk image before doing > > > > anything. If you don't like using dd, try "man truncate" > > > > > > > > Also, for reference, extending the file image is only possible if the > > > > image is raw (the default format on Centos' Xen). qemu and vhd format > > > > can't be resized easily, and the "resize" process for these type of > > > > images is basically create a new, larger, disk image and copy the old > > > > content. > > > > > > > > > > > > > > 2) Signal the guest to notice the change in block size. I understand that > > > > > there is a process whereby you can tell the guest to re-read this, but > > > I've > > > > > never done it. > > > > > > > > IIRC this is only supported on newer versions of Xen, and only for PV > > > > Linux domUs. Centos doesn't have this feature. > > > > > > > > > A sure way is to stop it and restart it - just restarting > > > > > isn't enough. > > > > > > > > Yup. > > > > > > > > > > > > > > 3) Resize the filesystem using the appropriate tools. > > > > > > > > > > There are quite a few variations, which is right for you depends on you > > > you > > > > > have things set up. It may well be easier to just stop the guest, and > > > resize > > > > > the filesystem in Dom0 - this has the advantage that you don't need to > > > > > persuade the guest to unmount the filesystem if online expand isn't > > > > > supported. > > > > > > > > > > Also, if you have partitioned the virtual device in the guest then you'll > > > > > need to fiddle with the partitions on the resized virtual device - that > > > is > > > > > more work than just expanding a filesystem built straight on the device. > > > > > > > > If you use HVM domU (e.g Windows), and domU OS is installed on a > > > > partition, it might be easier to boot using some kind of livecd with > > > > gparted (e.g. gparted live, systemrescuecd, etc.) and use the GUI to > > > > resize the partition. > > > > > > Sorry for the missformated post, used the wrong formatting options in > Outlook. > > > So, here we go one more time, hopefully more readable: > > > > > > On XEN 3.3. as the Hypervisor I had a similiar task on a Windows 2011 SBS > Installation with four virtual disks, all based on LVM, a few days ago. > > > > > > Since none of the disks were system-disks, I stopped active processes like > Databases on these disks and did the following: > > > # removed the disk from DOMU with > > > xm block-detach DOMID BLOCKDEV-ID > > > > > > # resized the underlaying LVM > > > lvresize -L80G virt_vm_vg-w2k11_sbs_databases > > > > > > # created a devicemapping of the Logical Volume (in DOM0) kpartx -a > /dev/mapper/virt_vm_vg/w2k11_sbs_databases > > > > > > # accessed the partition in the devicemap with fdisk fdisk > /dev/mapper/virt_vm_vg-w2k11_sbs_databases > > > # made a note of the startsector > > > # deleted the partition > > > # not really without some kind of exertion ;-) > > > # created a new partition over the whole diskspace now available, > > > # using the before noted startsector as the beginning of the new partition > > > # and type=7 hpfs/ntfs > > > > > > # using ntfsresize from ntfsprogs to resize the ntfs-partition ntfsresize > /dev/mapper/virt_vm_vg/w2k11_sbs_databases > > > > > > # removed the devicemapping > > > kpartx -d /dev/mapper/virt_vm_vg/w2k11_sbs_databases > > > > > > # re-attached the disk to the DOMU > > > # xm block-attach DOM-ID phy:/dev/virt_vm_vg/w2k11_sbs_databases xvd[a-n] w > > > # Inside the DOMU it is normal, that the system want's to run chkdsk on the > newly > > > # extended filesystem > > > > > > Before applying these modifications to a production system one should be > prepared in terms of "wearing belt and suspenders" with a good backup and - > what I did - with a "stupid" windows xp DOMU to test the above scenario. > > > > > > Hints: > > > Within my tests on the windows xp DOMU (with two partitions in it), I had a > problem with kpartx, removing the before created devicemaps. > > > After some time of investigating I found the solution in using dmsetup to > remove in a first step the second partition with: > > > dmsetup -f remove /dev/mapper/virt_vm_vg-xpp_sp3_corp2 > > > and afterwards removing the first partition with dmsetup -f remove > /dev/mapper/virt_vm_vg-xpp_sp3_corp > > > > > > As Fajar mentioned, I also used an instance of SystemRescueCd as DOMU and > tried to attache one of the above virtual disks inside this DOMU. > > > But the problem was, the virtual disk had to be already present at the > creation of the DOMU. A later "block-attach statement" didn't made the disk > visible in the DOMU. > > > So I decided to install the missing tools (ntfsprogs) in DOM0. > > > > > > Hope, this helps others to save some time and headache > > > > > > Regards, Guido > > > > > > > > > > > Note however that default Centos installation use LVM on domU side. In > > > > this case it's MUCH easier to simply add NEW disk image, and use LVM > > > > on domU (vgextend, lvextend) to grow the VG and LV. > > > > > > > > -- > > > > Fajar > > > > > > > > _______________________________________________ > > > > Xen-users mailing list > > > > Xen-users@xxxxxxxxxxxxxxxxxxx > > > > http://lists.xensource.com/xen-users > > > > > > _______________________________________________ > > > Xen-users mailing list > > > Xen-users@xxxxxxxxxxxxxxxxxxx > > > http://lists.xensource.com/xen-users > > > _______________________________________________ Xen-users mailing list Xen-users@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-users
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |