Thursday, January 27, 2011

Oracle VM Server adding Space on Vm Guest

I have a 1Terrabyte space on /FAW, out of which I want to use 500G for Guest OS.


1) First create a disk2.img file with 500G space on the Oracle VM server (Host OS)
# dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G


2) Adding the same to your vm.cfg config file :


'file:/FMW/xen_vm/disk2.img,sdf,w',

3) After you Login to VM guest , now fisk with partition name you defined in the File
# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4) 
p
Partition number (1-4): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270):
Using default value 65270

Command (m for help): p

Disk /dev/sdf: 536.8 GB, 536870913024 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       65270   524281243+  83  Linux


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@linux1/]#

4) Now adding the disk to Logical Volume manager in the same Guest OS.


# hostname
linux1

# pvcreate /dev/sdf1    <==== this is creadted using fdisk after logging in to vm guest
  Physical volume "/dev/sdf1" successfully created


# vgcreate xen-vm /dev/sdf1
  Volume group "xen-vm" successfully created


# lvcreate  -L450G -nxen_prov xen-vm
  Logical volume "xen_prov" created


# lvscan
  ACTIVE            '/dev/xen-vm/xen_prov' [450.00 GB] inherit


# mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3600 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
bash#



After reboot of guest os, mount is gone rest all remains intact .


so :


Have to remount to see the partition:



[root@linux1 /]# mount /dev/xen-vm/xen_prov /xen
[root@linux1 /]# cd /xen
[root@linux1 xen]# df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/xen--vm-xen_prov
                      443G  199M  421G   1% /xen
[root@linux1 xen]#



No comments:

Post a Comment