免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1319 | 回复: 0
打印 上一主题 下一主题

XEN extend DomU disk (转) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-31 17:44 |只看该作者 |倒序浏览

               
                        XEN extend DomU disk       
Extend DomU's LVM/DRBD disk
I had a need to extend one disk
in a DomU I use as a file share. This disk is configured for the DomU
in addition to the root and swap. This disk is mounted in the DomU and
used as the NFS and Samba root. Before I extended this disk I used a
test DomU to perform the same operation, on that test DomU I extended
the root partition to see if that would cause any problems.
I was
successful in all my tests and the only downtime during this operation
was a reboot of the DomU. So extending any partition matching the
prerequisites below should work without problems.
Below I will described how I went along.
Prerequisites
You need to have a DomU installed as described in my
XEN cluster HowTo
.
The DomU will have a separate DRBD device for each file system with the
underlying device being a Logical Volume (LV). So for a system with a
root and a swap partition, you would have two DRBD devices in the Dom0
each with an underlying LV. So no partitioning should be done in the
DomU.
Procedure
We start by extending the underlying Logical Volume (LV) on both nodes. Run the following (on both nodes):
lvextend -v -L+100G /dev/vg/test-disk
This will extend the LV called "test-disk" in the Volume Group "vg" with 100GB.
Next
step is to extend the corresponding DRBD device so it knows about the
increased size of the LV. This step is only required on one node.
Run the following only on the primary node:
root@ha1:/# drbdadm resize test-disk
This will resize the DRBD device called test-disk. Note that I use the same name for the LV as for the DRBD device.
Reboot DomU:
root@ha1:/# xm console test
test:/# reboot
After
reboot we need to resize the file system. My device is called /dev/xvdc
and it had an original size of 100GB, so I resized /dev/xvdc to 200GB.
Login to the DomU again and perform the resize:
root@ha1:/# xm console test
test:/# resize2fs /dev/xvdc 200G
Done!
Or
atleast now you only have to wait for the resize to complete. Please be
patient because it can take some time. My resize from 100GB to 200GB
took at least 10-15 minutes.
Below you fill find the output from "df -h" before and after the resize as well as the output of the resize2fs command:

Before RESIZE:
test:/# df -h[color="#0000ff"]Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda             9.9G  1.8G  7.6G  19% /
tmpfs                 193M     0  193M   0% /lib/init/rw
udev                  193M   44K  193M   1% /dev
tmpfs                 193M  4.0K  193M   1% /dev/shm
/dev/xvdc              99G   91G  3.1G  97% /data

Performing the RESIZE:
test:/# resize2fs /dev/xvdc 200G[color="#0000ff"]resize2fs 1.40-WIP (14-Nov-2006)
[color="#0000ff"]Filesystem at /dev/xvdc is mounted on /data; on-line resizing required
[color="#0000ff"]old desc_blocks = 7, new_desc_blocks = 13
[color="#0000ff"]Performing an on-line resize of /dev/xvdc to 52428800 (4k) blocks.
[color="#0000ff"]The filesystem on /dev/xvdc is now 52428800 blocks long.
After RESIZE:
test:/# df -h [color="#0000ff"]Filesystem            Size  Used Avail Use% Mounted on
[color="#0000ff"]/dev/xvda             9.9G  1.8G  7.6G  19% /
[color="#0000ff"]tmpfs                 193M     0  193M   0% /lib/init/rw
[color="#0000ff"]udev                  193M   44K  193M   1% /dev
[color="#0000ff"]tmpfs                 193M  4.0K  193M   1% /dev/shm
[color="#0000ff"]/dev/xvdc             197G   91G   97G  49% /data
       
                Last Updated on Sunday, 26 October 2008 09:20
转自 http://www.asplund.nu/xencluster/xen-extend-domu-disk.html
               
               
       
       
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94529/showart_2042250.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP