Chinaunix首页 | 论坛 | 博客
  • 博客访问: 380893
  • 博文数量: 114
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1219
  • 用 户 组: 普通用户
  • 注册时间: 2015-02-07 21:23
文章分类

全部博文(114)

文章存档

2018年(1)

2017年(5)

2016年(87)

2015年(21)

我的朋友

分类: 系统运维

2016-01-29 17:02:52


  1. 第一步
  2. 添加第二块硬盘sdb进行分区
  3. [root@linuxidc ~]# fdisk /dev/sdb
  4. n+P+4+空格+w
  5. 说明:上面操作对sdb硬盘进行了分区操作,设为sdb4分区了(当然上面建立的主分区可以为1-4中的任意一个,我这里选择的4)。
  6.  第二步、对新建立的sdb4分区进行格式
  7. [root@linuxidc ~]# mkfs.ext4 /dev/sdb4
  8. mke2fs 1.41.12 (17-May-2010)
  9. 文件系统标签=
  10. 操作系统:Linux
  11. 块大小=4096 (log=2)
  12. 分块大小=4096 (log=2)
  13. Stride=0 blocks, Stripe width=0 blocks
  14. 1048576 inodes, 4192957 blocks
  15. 209647 blocks (5.00%) reserved for thesuper user
  16. 第一个数据块=0
  17. Maximum filesystem blocks=4294967296
  18. 128 block groups
  19. 32768 blocks per group, 32768 fragments pergroup
  20. 8192 inodes per group
  21. Superblock backups stored on blocks:
  22.  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
  23.  4096000
  24.  正在写入inode表: 完成
  25. Creating journal (32768 blocks): 完成
  26. Writing superblocks and filesystemaccounting information: done完成
  27.  This filesystem will be automaticallychecked every 20 mounts or
  28. 180 days, whichever comes first. Use tune2fs -c or -i to override.
  29.  说明:将sdb4分区格式化为ext4格式,因为CentOS安装是系统的格式ext4,所以这里要注意一下。
  30.  第三步、格式后的sdb4分区添加为物理卷
  31. [root@linuxidc ~]# pvcreate /dev/sdb4
  32. Physical volume "/dev/sdb4" successfully created
  33. 第四步、查看当前系统的物理卷(PV)情况
  34.  [root@linuxidc ~]# pvdisplay
  35. ---Physical volume ---
  36. PVName /dev/sda2
  37. VGName VolGroup
  38. PVSize 15.51 GiB / not usable3.00 MiB
  39. Allocatable yes (butfull)
  40. PESize 4.00 MiB
  41. Total PE 3970
  42. Free PE 0
  43. Allocated PE 3970
  44. PVUUID Up77sG-sNKf-Ja0k-crBf-N0wz-a5hy-T6sVFh
  45.  "/dev/sdb4" is a new physical volume of "15.99 GiB"
  46. ---NEW Physical volume ---
  47. PVName /dev/sdb4
  48. VGName
  49. PVSize 15.99 GiB
  50. Allocatable NO
  51. PESize 0
  52. Total PE 0
  53. Free PE 0
  54. Allocated PE 0
  55. PVUUID Gqnw7N-HooX-S2Nz-1NIZ-YpOe-g0jo-grG1rQ
  56. 说明:可以看到添加的新物理卷sdb4,大小都符合我们添加时的设置
  57.  第五步、查看当前卷组情况
  58. [root@linuxidc ~]# vgdisplay
  59. ---Volume group ---
  60. VGName VolGroup
  61. System ID
  62. Format lvm2
  63. Metadata Areas 1
  64. Metadata Sequence No 3
  65. VGAccess read/write
  66. VGStatus resizable
  67. MAXLV 0
  68. CurLV 2
  69. Open LV 2
  70. MaxPV 0
  71. CurPV 1
  72. ActPV 1
  73. VGSize 15.51 GiB
  74. PESize 4.00 MiB
  75. Total PE 3970
  76. Alloc PE / Size 3970 / 15.51GiB
  77. Free PE / Size 0 / 0
  78. VGUUID PPrifh-glzl-nnxX-YkBm-xJ1s-rgnw-d1WsJd
  79.  第六步、将分区sdb4转换为扩展分区
  80.  [root@linuxidc ~]# vgextend VolGroup/dev/sdb4
  81. Volume group "VolGroup" successfully extended
  82.  第七步、查看当前的逻辑卷
  83.  [root@linuxidc ~]# lvdisplay
  84. ---Logical volume ---
  85. LVPath /dev/VolGroup/lv_root
  86. LVName lv_root
  87. VGName VolGroup
  88. LVUUID dCIsej-0NWX-bVFe-bT6L-c4eY-oy4G-9lNBOC
  89. LVWrite Access read/write
  90. LVCreation host, time ,
  91. LVStatus available
  92. #open 1
  93. LVSize 7.75 GiB
  94. Current LE 1985
  95. Segments 1
  96. Allocation inherit
  97. Read ahead sectors auto
  98. -currently set to 256
  99. Block device 253:0
  100.  ---Logical volume ---
  101. LVPath /dev/VolGroup/lv_swap
  102. LVName lv_swap
  103. VGName VolGroup
  104. LVUUID K5bxJo-2SmM-6NCU-mBJP-Qzp1-ZODH-nbLK0k
  105. LVWrite Access read/write
  106. LVCreation host, time ,
  107. LVStatus available
  108. #open 1
  109. LVSize 7.75 GiB
  110. Current LE 1985
  111. Segments 1
  112. Allocation inherit
  113. Read ahead sectors auto
  114. -currently set to 256
  115. Block device 253:1
  116.  说明:这里可以看到“/”根分区的路径名称为:/dev/VolGroup/lv_root
  117.  第八步、查看扩展后的卷组情况
  118. [root@linuxidc ~]# vgdisplay
  119. ---Volume group ---
  120. VGName VolGroup
  121. System ID
  122. Format lvm2
  123. Metadata Areas 2
  124. Metadata Sequence No 4
  125. VGAccess read/write
  126. VGStatus resizable
  127. MAXLV 0
  128. CurLV 2
  129. Open LV 2
  130. MaxPV 0
  131. CurPV 2
  132. ActPV 2
  133. VGSize 31.50 GiB
  134. PESize 4.00 MiB
  135. Total PE 8064
  136. Alloc PE / Size 3970 / 15.51GiB
  137. Free PE / Size 4094 / 15.99 GiB
  138. VGUUID PPrifh-glzl-nnxX-YkBm-xJ1s-rgnw-d1WsJd
  139. 说明:扩展后的卷子情况
  140.  第九步、将新增的逻辑卷全部扩展到“/”分区中
  141. 扩展逻辑卷LogVol00的容量(根目录"/"的挂载点)
  142. lvextend -L +1024M /dev/VolGroup00/LogVol00
  143. /sbin/resize2fs /dev/VolGroup00/LogVol00
  144. 说明:-L 添加所需大小,resize2fs刷新根分区大小

阅读(1474) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~