知识库

标准化实施手册及常见错误


磁盘扩容-添加新磁盘到卷组

<p>[TOC]</p> <p><strong>环境情况说明:</strong> <strong>现有挂载路径及大小</strong>:df -h <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/50b38809083ebfcb841b68e3683823c7" alt="" /> <strong>已创建卷组</strong>:vgdisplay risen <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/9d17d7de4d8a2ee859cf0de73e6b0377" alt="" /> <strong>已创建逻辑卷</strong>:lvdisplay /dev/risen/lvdata <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/b546fee95478ebe4d508306a1b31e0ea" alt="" /></p> <h3>一、查看新磁盘</h3> <p><code>lsblk</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/da0c4a7fde4c3a7146c9c0783ad0fc19" alt="" /> <code>fdisk -l</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/d1a6445fe254f164d60c977a5f9ade16" alt="" /></p> <h3>二、对新的磁盘进行分区(磁盘个数不限)</h3> <p><strong>对sdb进行分区</strong> <code>parted /dev/sdb</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/223c8389b8ab1ad7a08dd2d444fd9efd" alt="" /> <code>mklabel</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/c221507b6a6e50893c55510439d84559" alt="" /> <code>gpt</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/deecdf7ee8a5c1d887a44781b2a00f16" alt="" /> <code>mkpart</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/91e504149c980d950df1804bfe71bde1" alt="" /> <code>xfs</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/df308cb4934af9a9fb58b71e7e3205aa" alt="" /> <code>1</code> <code>2G</code> <strong>#根据上图查看的磁盘实际大小填写</strong> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0ffa8741fe9aa1f2565d395815a8c8b2" alt="" /> <code>q</code></p> <h3>三、创建物理卷,添加到已有的卷组和逻辑卷中</h3> <p>创建/dev/sdb物理卷: <code>pvcreate /dev/sdb1</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/f353e698040a5dd8043ac66d27d8f7ee" alt="" /> <strong>扩展卷组,并将物理卷加入已有卷组risen中:</strong> <code>vgextend risen /dev/sdb1</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/7ca4d5c1f841e375086557f9026df22e" alt="" /> <strong>查看卷组当前内存大小情况:</strong> <code>vgdisplay risen</code> (由原来的5G增加到7G) <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/98e7ff5ce142ce89abbf27f24279ea53" alt="" /> <strong>扩展lvdata逻辑卷,分配全部剩余内存:</strong> <code>lvextend -l +100%FREE /dev/risen/lvdata</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/337568320a8e5737e607dce8b3e829c7" alt="" /> <strong>查看逻辑卷当前内存大小情况:(由原来的5G增加到7G)</strong> <code>lvdisplay /dev/risen/lvdata</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/504d4fb2f512486d0c18d3adf79ed713" alt="" /> <strong>查看文件类型:</strong> <code>cat /etc/fstab</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/44a97b77e3f499521089c81bbcb0f640" alt="" /> <strong><code>注意:xfs文件系统使用 xfs_growfs,ext文件系统使用 resize2fs;xfs文件系统只支持增大不支持缩小</code></strong> 重新激活分区表: <code>xfs_growfs /dev/risen/lvdata</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/c2551db9c7a619bfd1abeda0c1669339" alt="" /> <strong>查看是否扩容成功:</strong> <code>df -h</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/24b08e8c907287074cacc93f9f8b8275" alt="" /></p> <h2>逻辑卷扩容成功</h2>

页面列表

ITEM_HTML