知识库

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


磁盘分区-新磁盘逻辑卷分区

<p>[TOC]</p> <h3>一、加入新磁盘</h3> <p><code>lsblk</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/8b6ee86e5424dddd06ec0a63831c4225" alt="" /> <code>fdisk -l</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/57d3d3f7bb53863da1c57f485f333979" alt="" /></p> <h3>二、对单个或多个新磁盘进行分区(磁盘个数不限)</h3> <p><strong>对sdb进行分区</strong> <code>parted /dev/sdb</code> <code>mklabel</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/f673ba1f737ee15e560ee40fcc0101c0" alt="" /> <code>gpt</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/07a66c66d011818beedd00ae15cf2397" alt="" /> <code>mkpart</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/69ee58f45752133c6ada14e3fe641697" alt="" /> <code>xfs</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/ded6c91c1f994a869265074b76c33cfb" alt="" /> <code>1</code> <code>2G #根据上图查看的磁盘实际大小填写</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/50572c8b87e9e93c3530a382d5cf73f3" alt="" /> <code>q</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/61e7e7dc9caf9fefab186fac401e0cbc" alt="" /></p> <p><strong>对sdc进行分区,步骤同上</strong> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/d0c43620267ad6c42b4cb9c47963f28b" alt="" /></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/88445d96a6fc8d09def69db6134119ea" alt="" /> 创建/dev/sdc物理卷:<code>pvcreate /dev/sdc1</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/04e5f7a4c18932949cabe90a7fd66adb" alt="" /> 创建卷组,并将物理卷加入其中(risen为卷组名):<code>vgcreate risen /dev/sdb1 /dev/sdc1</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0cc971e322c19393bd32bc8013193e35" alt="" /> 查看卷组空间大小及剩余大小:<code>vgs</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/8b0b96d2d3d75474556a605c3d39b811" alt="" /> 创建逻辑卷并分配大小: <code>lvcreate -l +100%FREE -n lvdata risen</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/e32753b715f5a2e10e47acd1c83c356e" alt="" /> 格式化逻辑卷:<code>mkfs.xfs /dev/mapper/risen-lvdata</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/63dd24852e223e173fbae26740d6fbbd" alt="" /> 创建挂载点文件:<code>mkdir -p /data</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/cdaffb6e809f21d229e83485e7bcfb1f" alt="" /> 查看设备系统文件类型及UUID:<code>blkid</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/96e63dd91df4c133269a90b5afd1f39a" alt="" /> 挂载新硬盘配置文件(此处uuid为上图查出结果):<code>vi /etc/fstab</code> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/886a5aa73ce1704cfa8f6b1cdded79c4" alt="" /> 此UUID是示范,请根据blkid命令显示实际的UUID为准</p> <p><code>UUID=37316a59-80b3-49dd-87a3-94819757182f /data xfs defaults 0 0</code></p> <p>挂载逻辑卷:<code>mount -a</code> <code>df -h</code> 查看挂载情况,大小为两个硬盘总和 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/d66af7c906be3af08dcbad1e991976dd" alt="" /></p>

页面列表

ITEM_HTML