设为首页 收藏本站
查看: 370|回复: 0

[经验分享] Extend Disk Space in Oracle VM

[复制链接]

尚未签到

发表于 2016-7-29 10:50:18 | 显示全部楼层 |阅读模式
  Extend Disk Space in Oracle VM
1. Oracle provides templates of Linux Enterprise (OEL5), but the free disk space is very small (around 10G).
Enterprise Linux Release 5 Update 4 Media Pack for x86 (32 bit)
  
  2. If you want to extend the system to install more software, the free disk space is not enough. Here are the steps to enlarge the free disk space of the guest OVM.
[iyunv@oslcn33 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda2             4079492   2057376   1980108  51% /
/dev/xvda1               93307     11635     76855  14% /boot
tmpfs                  2097240         0   2097240   0% /dev/shm

  a) In the host server, run dd command to create img file to allocate extra disk space.
Allocate 150G free disk space to expand.img.
[iyunv@oslcn30 OVM_EL5U4_X86_PVM_4GB]# dd if=/dev/zero bs=1G count=150 >> /OVS/seed_pool/OVM_EL5U4_X86_PVM_4GB/expand.img
150+0 records in
150+0 records out
161061273600 bytes (161 GB) copied, 1957.43 seconds, 82.3 MB/s

  
  b) Shutdown guest VM
[iyunv@oslcn30 OVM_EL5U4_X86_PVM_4GB]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   569     2     r-----   1455.3
OVM_EL5U4_X86_PVM_4GB                       11  4096     2     -b----     20.9

  
  
  [iyunv@oslcn30 OVM_EL5U4_X86_PVM_4GB]# xm shutdown OVM_EL5U4_X86_PVM_4GB
  
  c) Change vm.cfg
  add ,'file:/OVS/seed_pool/OVM_EL5U4_X86_PVM_4GB/expand.img,xvdb,w' to disk line
[iyunv@oslcn30 OVM_EL5U4_X86_PVM_4GB]# vi vm.cfg
bootloader = '/usr/bin/pygrub'
disk = ['file:/OVS/seed_pool/OVM_EL5U4_X86_PVM_4GB/System.img,xvda,w', 'file:/OVS/seed_pool/OVM_EL5U4_X86_PVM_4GB/expand.img,xvdb,w']
memory = '4096'
name = 'OVM_EL5U4_X86_PVM_4GB'
vcpus = 2
on_crash = 'restart'
on_reboot = 'restart'
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0']
vif = ['']

  
  d) Re-create guest VM
[iyunv@oslcn30 OVM_EL5U4_X86_PVM_4GB]# xm create vm.cfg
Using config file "./vm.cfg".
Started domain OVM_EL5U4_X86_PVM_4GB (id=11)

  
  e) Using VNC to login the guest VM and Use fdisk to create new partition
[iyunv@oslcn33 software]# fdisk /dev/xvdb
  The number of cylinders for this disk is set to 19581.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

  Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

  Use ‘t’ to change the system id: 8e  --this is LVM type
Use ‘n’ to create new partition
Use ‘w’ to write and exit
 
f) Using the LVM to make the new partition available to current system.
# pvcreate /dev/xvdb   --create physical volume
# pvcreate /dev/xvdb1  -- use the disk partition
# vgcreate extvg /dev/xvdb1 –create volume group
# vgchange -a y  extvg  --active the volume group
# vgdisplay extvg | grep "Total PE" –check volume group size.
Total PE              38399
# lvcreate -l 38399 extvg -n extlv –create logic volume with the max size.
Create file system on logic volume.
# mke2fs /dev/extvg/extlv
or reiserfs:
# mkreiserfs /dev/extvg/extlv
  
  g) Mount the new partition to current file sysem.
[iyunv@oslcn33 ~]# mount /dev/extvg/extlv /u01
  
  h) Check result:
[iyunv@oslcn33 software]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda2             4079492   2058508   1978976  51% /
/dev/xvda1               93307     11635     76855  14% /boot
tmpfs                  2097240         0   2097240   0% /dev/shm
/dev/mapper/extvg-extlv
                     154814444     60872 146889460   1% /u01

  
  i) auto mount on startup:
[iyunv@oslcn33 ~]# vi /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
/dev/extvg/extlv        /u01                    ext2    defaults        1 2
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
LABEL=SWAP-VM           swap                    swap    defaults        0 0

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-251104-1-1.html 上篇帖子: (转)ORACLE 中ROWNUM用法总结! 下篇帖子: 关于错误oracle.jdbc.OracleDriver的解决
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表