硬盘扩容后,增加到lvm中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
硬盘扩容后,增加到lvm中
1、查看原有配置信息
    [root@vm132 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_vm132-LogVol01
                          7.5G  670M  6.5G  10% /
    tmpfs                 495M     0  495M   0% /dev/shm
    /dev/sda1             488M   32M  431M   7% /boot
    /dev/mapper/vg_vm132-LogVol00
                          9.5G   22M  9.0G   1% /home
    [root@vm132 ~]# vgdisplay
      --- Volume group ---
      VG Name               vg_vm132
      System ID            
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               17.50 GiB
      PE Size               4.00 MiB
      Total PE              4479
      Alloc PE / Size       4479 / 17.50 GiB
      Free  PE / Size       0 / 0  
      VG UUID               iEINsi-H04G-0nnw-nlNk-7cn3-ajqK-2oHAIU
        
    [root@vm132 ~]# pvdisplay
      --- Physical volume ---
      PV Name               /dev/sda3
      VG Name               vg_vm132
      PV Size               17.50 GiB / not usable 3.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              4479
      Free PE               0
      Allocated PE          4479
      PV UUID               Bsdf9l-0Fd6-vMOL-1YOi-kvkM-8nUe-Em3KfP
     
    [root@vm132 ~]# lvdisplay
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol01
      LV Name                LogVol01
      VG Name                vg_vm132
      LV UUID                ML4A49-2a3o-ZjQP-0hQf-xeJ5-34ox-cceWPN
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:41 +0800
      LV Status              available
      # open                 1
      LV Size                7.73 GiB
      Current LE             1979
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
        
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol00
      LV Name                LogVol00
      VG Name                vg_vm132
      LV UUID                Rc0FSV-5aA0-zMND-4Dmt-0asQ-CEeC-fR3IwM
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:44 +0800
      LV Status              available
      # open                 1
      LV Size                9.77 GiB
      Current LE             2500
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
    
2、对新增磁盘空间进行分区
    [root@vm132 ~]# fdisk /dev/sda
 
    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
 
    Command (m for help): p
 
    Disk /dev/sda: 32.2 GB, 32212254720 bytes
    255 heads, 63 sectors/track, 3916 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0003ed99
 
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          66      524288   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              66         327     2097152   82  Linux swap / Solaris
    Partition 2 does not end on cylinder boundary.
    /dev/sda3             327        2611    18349056   8e  Linux LVM
 
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Selected partition 4
    First cylinder (2611-3916, default 2611):
    Using default value 2611
    Last cylinder, +cylinders or +size{K,M,G} (2611-3916, default 3916):
    Using default value 3916
 
    Command (m for help): t
    Partition number (1-4): 4
    Hex code (type L to list codes): 8e
    Changed system type of partition 4 to 8e (Linux LVM)
 
    Command (m for help): p
 
    Disk /dev/sda: 32.2 GB, 32212254720 bytes
    255 heads, 63 sectors/track, 3916 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0003ed99
 
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          66      524288   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              66         327     2097152   82  Linux swap / Solaris
    Partition 2 does not end on cylinder boundary.
    /dev/sda3             327        2611    18349056   8e  Linux LVM
    /dev/sda4            2611        3916    10483750   8e  Linux LVM
 
    Command (m for help): w
    The partition table has been altered!
 
    Calling ioctl() to re-read partition table.
 
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
    [root@vm132 ~]# init 6     -----重启
3、创建pv卷
    [root@vm132 ~]# pvcreate /dev/sda4
      Physical volume "/dev/sda4" successfully created
4、扩容到vg中
    [root@vm132 ~]# vgdisplay
      --- Volume group ---
      VG Name               vg_vm132
      System ID            
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               17.50 GiB
      PE Size               4.00 MiB
      Total PE              4479
      Alloc PE / Size       4479 / 17.50 GiB
      Free  PE / Size       0 / 0  
      VG UUID               iEINsi-H04G-0nnw-nlNk-7cn3-ajqK-2oHAIU
    [root@vm132 ~]# vgextend vg_vm132 /dev/sda4
      Volume group "vg_vm132" successfully extended
    [root@vm132 ~]# vgdisplay
      --- Volume group ---
      VG Name               vg_vm132
      System ID            
      Format                lvm2
      Metadata Areas        2
      Metadata Sequence No  4
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                2
      Act PV                2
      VG Size               27.49 GiB
      PE Size               4.00 MiB
      Total PE              7038
      Alloc PE / Size       4479 / 17.50 GiB
      Free  PE / Size       2559 / 10.00 GiB
      VG UUID               iEINsi-H04G-0nnw-nlNk-7cn3-ajqK-2oHAIU
5、扩容到lv中
    [root@vm132 ~]# lvdisplay
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol01
      LV Name                LogVol01
      VG Name                vg_vm132
      LV UUID                ML4A49-2a3o-ZjQP-0hQf-xeJ5-34ox-cceWPN
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:41 +0800
      LV Status              available
      # open                 1
      LV Size                7.73 GiB
      Current LE             1979
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
        
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol00
      LV Name                LogVol00
      VG Name                vg_vm132
      LV UUID                Rc0FSV-5aA0-zMND-4Dmt-0asQ-CEeC-fR3IwM
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:44 +0800
      LV Status              available
      # open                 1
      LV Size                9.77 GiB
      Current LE             2500
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
 
    [root@vm132 ~]# lvdisplay
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol01
      LV Name                LogVol01
      VG Name                vg_vm132
      LV UUID                ML4A49-2a3o-ZjQP-0hQf-xeJ5-34ox-cceWPN
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:41 +0800
      LV Status              available
      # open                 1
      LV Size                7.73 GiB
      Current LE             1979
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
        
      --- Logical volume ---
      LV Path                /dev/vg_vm132/LogVol00
      LV Name                LogVol00
      VG Name                vg_vm132
      LV UUID                Rc0FSV-5aA0-zMND-4Dmt-0asQ-CEeC-fR3IwM
      LV Write Access        read/write
      LV Creation host, time vm132.wanghz.com, 2020-06-15 21:36:44 +0800
      LV Status              available
      # open                 1
      LV Size                9.77 GiB
      Current LE             2500
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
        
    [root@vm132 ~]# lvextend -L +9.9G /dev/vg_vm132/LogVol00
      Rounding size to boundary between physical extents: 9.90 GiB.
      Size of logical volume vg_vm132/LogVol00 changed from 9.77 GiB (2500 extents) to 19.67 GiB (5035 extents).
      Logical volume LogVol00 successfully resized.
    [root@vm132 ~]# resize2fs /dev/vg_vm132/LogVol00
    resize2fs 1.41.12 (17-May-2010)
    Filesystem at /dev/vg_vm132/LogVol00 is mounted on /home; on-line resizing required
    old desc_blocks = 1, new_desc_blocks = 2
    Performing an on-line resize of /dev/vg_vm132/LogVol00 to 5155840 (4k) blocks.
    The filesystem on /dev/vg_vm132/LogVol00 is now 5155840 blocks long.
 
    [root@vm132 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_vm132-LogVol01
                          7.5G  670M  6.5G  10% /
    tmpfs                 495M     0  495M   0% /dev/shm
    /dev/sda1             488M   32M  431M   7% /boot
    /dev/mapper/vg_vm132-LogVol00
                           20G   27M   19G   1% /home

  

posted @   MR__Wang  阅读(382)  评论(1编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
历史上的今天:
2018-06-15 php7 安装mssql 扩展
点击右上角即可分享
微信分享提示