感谢支持
我们一直在努力

CentOS 6.3增加新硬盘创建逻辑卷

现有一台服务器已经安装了操作系统,接上了盘柜以后,需要创建逻辑卷以供系统挂载使用。整个磁盘作为一个分区,CentOS 6.3文件系统有最大16T限制。

 首先清除磁盘上的分区表信息:
 [root@SD-H0-ATTACH-G0S0 ~]# dd if=/dev/zero of=/dev/sda bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000446406 s, 1.1 MB/s

创建物理卷
 [root@SD-H0-ATTACH-G0S0 ~]# pvcreate /dev/sda
  Writing physical volume data to disk “/dev/sda”
  Physical volume “/dev/sda” successfully created

[root@SD-H0-ATTACH-G0S0 ~]# pvdisplay
  — Physical volume —
  PV Name              /dev/sdb2
  VG Name              vg_lvs2
  PV Size              1.09 TiB / not usable 3.00 MiB
  Allocatable          yes (but full)
  PE Size              4.00 MiB
  Total PE              285762
  Free PE              0
  Allocated PE          285762
  PV UUID              93Hrn1-R8m4-fv8S-S7G6-3vpa-N4EH-GOevM9
 
  — Physical volume —
  PV Name              /dev/sda
  VG Name              vg_mongodb
  PV Size              18.19 TiB / not usable 4.00 MiB
  Allocatable          yes
  PE Size              4.00 MiB
  Total PE              4767999
  Free PE              4767999
  Allocated PE          0
  PV UUID              nUhMM9-S51t-nlKz-wgVS-nkCh-sgXD-Qr4bZv

创建物理卷组
 [root@SD-H0-ATTACH-G0S0 ~]# vgcreate vg_mongodb /dev/sda
  Volume group “vg_mongodb” successfully created
[root@SD-H0-ATTACH-G0S0 ~]# vgs
  VG        #PV #LV #SN Attr  VSize  VFree
  vg_lvs2      1  2  0 wz–n-  1.09t    0
  vg_mongodb  1  0  0 wz–n- 18.19t 18.19t

创建逻辑卷
 [root@SD-H0-ATTACH-G0S0 ~]# lvcreate -l 16T -n lv_mongodb vg_mongodb
  Logical volume “lv_mongodb” created

格式化文件系统
 [root@SD-H0-ATTACH-G0S0 ~]# mkfs.ext4 /dev/vg_mongodb/lv_mongodb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1073741824 inodes, 4294967295 blocks
214748364 blocks (5.00%) reserved for the super user
First data block=0
131072 block groups
32768 blocks per group, 32768 fragments per group
8192 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, 214990848, 512000000, 550731776, 644972544, 1934917632,
        2560000000, 3855122432

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

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

挂载使用
 [root@SD-H0-ATTACH-G0S0 ~]# mount /dev/vg_mongodb/lv_mongodb /dragon/data
[root@SD-H0-ATTACH-G0S0 ~]#
[root@SD-H0-ATTACH-G0S0 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_lvs2-lv_root
                      1.1T  2.5G  1.1T  1% /
tmpfs                7.8G    0  7.8G  0% /dev/shm
/dev/sdb1            485M  58M  402M  13% /boot
/dev/mapper/vg_mongodb-lv_mongodb
                      16T  129M  15T  1% /dragon/data

赞(0) 打赏
转载请注明出处:服务器评测 » CentOS 6.3增加新硬盘创建逻辑卷
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏